When exactly did people start expecting Clojure to be as fast as Java
and/or Scala?

I seem to recall in one of the original Clojure videos, Rich talked
about the relationship between Clojure and Java.  There's a long
history of C programmers dropping down to assembly, Python programmers
dropping down to C, and so on.  He explained that Java was Clojure's
"assembly".  You use Clojure to write the logic that is too complex to
code compactly in Java.  You write Java to code the low-level bits you
can't do in Clojure.

I must admit I was surprised by Rich's recent statement that Clojure
is not useful to him if he can't write high performance code in it,
because he "only writes the hard bits".  To me this seemed like a
change of perspective from the days when it was accepted that the most
performance-critical parts would likely be implemented in Java;
perhaps the Clojure-in-Clojure project has gotten him more focused on
replacing Java entirely with Clojure.  He says we wouldn't like a
Clojure that was written in Clojure as it currently stands, because it
would be too slow.  That's probably true, but I never expected it to
be possible.  Up until this recent discussion, I believed that the
main focus for Clojure-in-clojure was to find ways to move more parts
into Clojure without affecting performance, in order to achieve better
portability to other hosts.  I didn't think it would ever be possible
to move all of it over.

I agree that it has been extraordinarily difficult to write
high-performance numerical code in Clojure.  I agree that everyone
benefits if this gets easier.  I want faster code as much as anyone.
But I'm worried that people's goals for static-typed-performance might
be unrealistic.  I'm delighted that Clojure already performs so well
for a dynamically typed language, thanks to Rich's hard work
optimizing the Java code that underlies Clojure so everything can be
as fast as possible, but it seems that a lot of people here will be
disappointed if Clojure can't compete with Java/Scala on the
benchmarks.

I'm glad someone is starting to tackle these benchmarks.  I think it's
especially interesting to see how fast the code can be when written
idiomatically, so I hope we'll see more of these results as well.
Once you start using mutable arrays and type hinting every single
variable, why aren't you just using Java?

With respect to this particular benchmark, I don't think it will be
possible to get idiomatic code in the same ballpark as Java, because
if you use Clojure's vectors to store the permuted values, they will
be boxed.  Unless Clojure starts having primitive vectors, I don't see
how it's possible to get around this.  But I'd love to be proven
wrong.

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