On Jun 30, 2009, at 19:07, Mark Engelberg wrote:

> On Tue, Jun 30, 2009 at 12:29 AM, Konrad
> Hinsen<konrad.hin...@laposte.net> wrote:
>> What is particularly nice about Clojure is that in most situations
>> you don't need to switch to Java for speed. You can optimize your
>> code by adding type hints and switching to low-level data structures
>> (unboxed ints and floats, arrays, ...) and get performance equal to
>> Java.
>
> I have heard this claim about Clojure's speed a number of times, and I
> am curious what the evidence for this claim is.  As far as I know, no
> one has written a suite of meaningful benchmarks to compare the
> performance of Clojure versus Java.

Right. The claim (at least when coming from me) is based entirely on  
micro-benchmarks that are probably of little practical importance.

> On the other hand, every month or so, someone posts here saying they
> tried to do a single benchmark, and it runs quite a bit slower than
> Java.  People help out, and usually some ways to improve the code are
> found, but I don't think I've ever seen the code actually get to the
> point where it has "performance equal to Java".

I suspect that the fundamental problem is the enormous difference  
between Clojure and Java. Translating idiomatic Java into Clojure is  
not likely to result in efficient code, and translating idiomatic  
Clojure into Java is likely to be a major headache.

For a practically valid comparison, you'd have to give the  
specification of a meaningful application to a few teams of competent  
Clojure programmers and a few teams of competent Java programmers,  
and compare the programs that all these teams produce. They might  
well be very different starting from the choice of algorithms and  
data structures.

My current approach is to work with Clojure as much as I can, knowing  
that in the worst case, there are other JVM languages, including Java  
itself, that I can turn to if I ever run into a serious performance  
problem.

Konrad.




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

Reply via email to