Thx for the answers,
but my point is not to make it run faster. I know i could use memoization
or use a loop with an accumulator variable.
Rather i want to find out why java is so much faster. Here my java
implementation (the same naive algorithm like the clojure version):
public static int fib(int n) {
if (n < 2) {
return n;
}
return fib(n - 1) + fib(n - 2);
}
I also did some measurements with:
* golang fib(32) took ~15 ms
* python fib(32) took ~ 800 ms
Hence clojure performance is closer to python (which is slow in my opinion)
than to a high optimized compiled language like Java.
I didn't understand it, i always thought Clojure performs similar to Java...
Daniel Gerlach
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.