It was pointed out on there that this is not only a language comparison but a data structure comparison as well. Also, there are no type hints in the Clojure code. Without type hints it would be expected to run significantly slower. It's still an interesting comparison because you would generally only use type hints in performance bottlenecks. I'd be especially interested in seeing what kind of difference it would make in this case.
Or write the whole thing in Clojure and drop to Java / Scala when you find bottlenecks. (In the same spirit of Python & Ruby people 'dropping to C' for performance when needed.)
It seems to me that Scala is becoming the de facto Java replacement; which strikes me as nothing but a good thing.
I don't think it's controversial at all. I prefer lisps in general, and that's pretty much the extent of it. I think Scala is a fine language, but it's not a lisp.
Out of curiosity, I wrote a simple non-optimized quicksort function in Common Lisp (SBCL) and timed a 180,000-element sort at 567ms, about half as much as the Java version. I'm sure that could be improved greatly with better coding and type hints.
9 comments
[ 5.7 ms ] story [ 103 ms ] threadIt was pointed out on there that this is not only a language comparison but a data structure comparison as well. Also, there are no type hints in the Clojure code. Without type hints it would be expected to run significantly slower. It's still an interesting comparison because you would generally only use type hints in performance bottlenecks. I'd be especially interested in seeing what kind of difference it would make in this case.
It seems to me that Scala is becoming the de facto Java replacement; which strikes me as nothing but a good thing.
I wonder how clojure would have done with the new transients syntax (http://clojure.org/transients).
Here's the code http://donnieknows.com/blog/sbcl-fast