Hello, after experimenting a bit, it seems that you can get a small gain by putting things in local variables (25% or so) but not much.
I looked at the implementation and I was assuming something that is not true: aset-double does not compile to JVM instructions for setting the array directly. It calls a method setDouble. I think the big difference between Clojure and java comes from that. When you write r[i] = ... in java, I believe it is compiled to not much more than a few bytecode instructions to arrange the stack and one to store in an array. When we do the same in Clojure, we call a function that call a method, that does that. As setting an array is very quick, even the slight overhead of calling a method makes the program far slower, in a tight loop. I will start another thread to ask whether this is really the problem and if it can be solved. Best, Nicolas. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---