On Tue, Jan 13, 2009 at 5:54 PM, Timothy Pratley
wrote:
>
> I'm not sure how to "cpu frequency set
> to not change" or how significant that is on my results.
I was afraid that was too vague a reference, sorry.
My laptop usually slows down the CPU when its idle or nearly so.
Specifically, the li
> ;; I defined my own access method so that an accessor is not required,
> ;; however then you need to type hint which makes it too clumsy
> ;; performs very similar to an accessor, in theory slightly faster
Actually there is a very simple way to make "by index" quite usable
without user type hin
> user=> (defstruct desilu :fred :ricky)
> #'user/desilu
> user=> (def x (map (fn [n]
> (struct-map desilu
>:fred n
>:ricky 2
>:lucy 3
>:ethel 4))
> (range 100)))
> #'user/x
> user=> (time (reduce (fn [n y
> With repeated runs, and my cpu frequency set to not change, I get very
> little speed improvement. I increased the size of the example range
> times 10 for these runs:
For me there is a very clear speed improvement of at least 40%, doing
quite a lot of repeated runs. I can't run with range tim
On Tue, Jan 13, 2009 at 2:23 PM, CuppoJava wrote:
>
> Do struct-maps also have boxing and unboxing overhead? Or does the JVM
> optimize that away?
Clojure collections currently store Objects, so they'll be boxed.
To store primitive values I think you'll have to use a Java array (but
only if all
Do struct-maps also have boxing and unboxing overhead? Or does the JVM
optimize that away?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
On Tue, Jan 13, 2009 at 2:18 AM, Timothy Pratley
wrote:
>
> BTW Rich,
>
> The documentation http://clojure.org/data_structures hints that
> accessors are faster than regular map lookups and provides the
> following example:
> (reduce (fn [n y] (+ n (:fred y))) 0 x)
> -> 45
> (reduce (fn
BTW Rich,
The documentation http://clojure.org/data_structures hints that
accessors are faster than regular map lookups and provides the
following example:
(reduce (fn [n y] (+ n (:fred y))) 0 x)
-> 45
(reduce (fn [n y] (+ n (fred y))) 0 x)
-> 45
However I think it would be cle
ah great explanation. That will help a lot. I found that annoying in
Java.
On Tue, Jan 13, 2009 at 1:38 AM, CuppoJava wrote:
>
> Do you know Java? It'll be easier to explain if you do.
>
> In Java, everything is an Object. Object's are treated as references
> to a specific memory location w
> {:x 0 :y 0 :z 0}
> I think a map would have too much overhead to retrieve and set keys.
> Is that correct? Although this is the most straight-forward
> conversion.
How about a structmap?
http://clojure.org/data_structures
"StructMaps
Often many map instances have the same base set of keys, for
Do you know Java? It'll be easier to explain if you do.
In Java, everything is an Object. Object's are treated as references
to a specific memory location which holds the actual data. So when you
pass an Object to a method, you're only passing the method the memory
location of that Object.
For p
I hear about boxing a lot. What is it? Thanks.
On Tue, Jan 13, 2009 at 12:49 AM, CuppoJava wrote:
>
> Hi,
> I'm still getting used to the primitive support in Clojure, and I want
> to confirm my understanding.
>
> As far as I know, primitive support is only supported in local let
> bindings, ri
Hi,
I'm still getting used to the primitive support in Clojure, and I want
to confirm my understanding.
As far as I know, primitive support is only supported in local let
bindings, right?
So in designing a vector math library,
To translate from Java, one would write a class with primitive field
13 matches
Mail list logo