

JVM Notebook: Basic Clojure, Java and JVM Language performance - icey
http://berlinbrowndev.blogspot.com/2009/07/jvm-notebook-basic-clojure-java-and-jvm.html

======
jm4
Here is a seemingly relevant thread from the Clojure group:
[http://groups.google.com/group/clojure/browse_thread/thread/...](http://groups.google.com/group/clojure/browse_thread/thread/289904c1a5deb8d8/07326af651db0ef8?lnk=gst&q=berlin+brown#07326af651db0ef8)

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.

------
radu_floricica
Persistent data structures are a lot slower then mutable ones, so this was no
surprise.

I wonder how clojure would have done with the new transients syntax
(<http://clojure.org/transients>).

------
macnod
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.

Here's the code <http://donnieknows.com/blog/sbcl-fast>

------
babo
OK, let's write the performance critical part in Java or Scala and Clojure
wins hands down for the rest, where we spend our development time at most.

~~~
icey
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.

~~~
MartinMond
I know it's a controversial question but why do you prefer Clojure over Scala?

~~~
icey
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.

~~~
MartinMond
I see. I expected some technical reason, but obviously personal preference is
fine too :)

~~~
icey
Well... I guess you could say preference for lisps is a technical reason; but
only if you are into macrology.

