> > I would like to somehow hide the global hilbert-map into my function,
> > but I can't see how to do that.
>
> Just put the literal directly into the function.
>
> > Is this possible? I know that I can just inert literal into my let,
> > but that degrades performance, when function is called many times.
>
> Have you tested it, using (time ...), preferably on the server VM? I
> wouldn't be surprised if a calculation that produces a constant gets
> optimized away to just the constant.

(time (dotimes [_ (int 10000)] (point-to-hilbert (rand-int (int
-1000)) (int 1) (int 16))))
(time (dotimes [_ (int 10000)] (point-to-hilbert-2 (rand-int (int
-1000)) (int 1) (int 16))))

"Elapsed time: 892.041865 msecs" - version with global
"Elapsed time: 1152.569949 msecs" - version with literal in let
statement inside the function

I only tested on client java 6, I have to install enterprise jdk, I
think, to be able to add parameter -server to the command line, now it
returns error.
Anyway, requiring users of for example game, to install non standard
java just to have the game run at good speed isn't the best way, so
I'll probably optimize for java -client anyway.

-- 
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