On Dec 14, 12:08 pm, James Reeves <weavejes...@googlemail.com> wrote:
> On Dec 14, 2:01 pm, Mike Perham <mper...@gmail.com> wrote:
>
> > Hi, I'm just learning Clojure but I thought I would do a little
> > experiment to see where Clojure sits performance-wise compared to a
> > number of other languages on the old Fibonacci sequence.  I think it
> > handles itself quite well.
>
> Interesting, but because your tests use a very inefficient algorithm,
> this is more a test of recursion than general performance. I find it
> quite intriguing that Java came out on top of GCC; I guess that must
> be Hotspot performing some optimizations.
>
Mike did not give any compiler settings -- with gcc 4.3.2 and -O3 on
64-bit Linux, I get these results:
[mic...@erdos fib]$ time ./a.out
165580141
real    0m0.670s
user    0m0.668s
sys     0m0.001s

[mic...@erdos fib]$ time ./a.out
165580141
real    0m0.677s
user    0m0.675s
sys     0m0.001s

[mic...@erdos fib]$ time ./a.out
165580141
real    0m0.673s
user    0m0.669s
sys     0m0.001s

And with Java,
[mic...@erdos fib]$ java Fib
time taken: 1279, res=165580141
[mic...@erdos fib]$ java Fib
time taken: 1369, res=165580141
[mic...@erdos fib]$ java Fib
time taken: 1276, res=165580141

And to demonstrate that Java is not the only fast JVM language:

[mic...@erdos bin]$ scala testing.Fib
time taken: 1292, res=165580141
[mic...@erdos bin]$ scala testing.Fib
time taken: 1246, res=165580141
[mic...@erdos bin]$ scala testing.Fib
time taken: 1264, res=165580141


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