On Jul 5, 3:18 am, fft1976 <fft1...@gmail.com> wrote: > On Jul 5, 2:31 am, Nicolas Oury <nicolas.o...@gmail.com> wrote: > > > After, when I run the benchmark in -server with a big enough CacheCode area > > (1000m), and enough iterations to have everything JITed, I get more than > > 860.000 iterations per second. (I benchmarked 100 000 000 iterations in 121 > > sec, on my 2.4GHz computer). > > That's 3000 clock cycles per VM instruction? I'm not very familiar > with the problem, but I thought "straight" C bytecode interpreters > were at around 30 and compiling the VM code to native code (with JIT) > reduced it to 7. Is this right?
On modern architectures, measuring performance in clock cycles is almost meaningless. I spend a reasonably amount of my working life making code run faster on game consoles; what I say here applies even more to modern x86 chips. After you have the best algorithm for the job, you very quickly find that going fast is entirely bound by memory speed (actually latency) - cache misses are the enemy. Obviously, in higher level languages like Clojure you need to take a few extra steps - get the right algorithm & make sure you are writing your code in a way that the JIT can optimize well. Once that is done you would ideally run a profiler that points out where you have cache misses - I think vTune does this. You can fake pre-fetching by issuing a read one cacheline ahead in your mainloop, though the JVM may drop this as useless work. If the JVM supported proper cache line fetching & zeroing, that would make high performance Java programs easier to write. BTW, I noticed that you mention that Clojure is not living up to its performance hype. In my experience, the biggest performance impact on code is who wrote it. It makes me cry when I see linear linked-list search of 5000+ strings using strcmp. Brad --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---