> That's very odd.
>
> Rich needs to take a look at this. Letting a constant shouldn't have a
> performance hit, IMO.
>
> Could you test whether it's faster to use your complex data structure
> directly in the function, anonymously at the point of use, or to yank it
> from a global var?

Code (can you run it on your computer to verify?):
http://clojure.pastebin.com/f508ad31b

My results (I've increased N to 100000 and cached random coordinates
in vector, to supply the same points to each version of function):

"Elapsed time: 2990.418336 msecs"
"point-to-hilbert-directly-from-global " nilnil

"Elapsed time: 2488.745357 msecs"
"point-to-hilbert-let-from-global " nilnil

"Elapsed time: 3669.685672 msecs"
"point-to-hilbert-literal-in-let " nilnil

"Elapsed time: 13039.499434 msecs"
"point-to-hilbert-literal-in-place " nilnil

With literal in place it is 10 seconds slower.

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to