Well, the question posed in the subject is whether Clojure can be as fast as Java. The answer to that question is yes. As with any generated code, there are many layers of optimization that could be performed. With Clojure being as young as it is, I doubt that generating isomorphic bytecode to that produced by javac has been the number one priority.
I don't believe that there's a hard and fast promise anywhere that Clojure will always run as fast as Java, and I don't believe that to be a reasonable expectation given the level of abstraction that it provides. Coming from certain other languages, I find it refreshing that Clojure at least gives you some facilities for optimization, and I've seen things like type hints improve execution times by an order of magnitude or better. You say that there's a difference between coming up with two snippits where performance is comparable and always achieving identical performance. I'm pretty sure there's a wide middle-ground between those extremes. I'm not sure how much programming you've done in Clojure and what your application domain is, but in my experience, it has performed adequately enough to replace Java for things such as acting as a network proxy and database programming. That being said, the language is still evolving all the time, and I'm certain performance will continue to improve. -Travis On Aug 11, 4:26 pm, fft1976 <fft1...@gmail.com> wrote: > On Aug 11, 1:09 pm, tmountain <tinymount...@gmail.com> wrote: > > > Yes, Clojure can be just as fast as Java. > > Then why is Andy's code 10x slower? > > > There's an example on the > > Clojure website that illustrates this. > > <snip>http://clojure.org/java_interop > > I've seen that. There is a difference between "I can come up with two > snippets in Java and Clojure doing the same thing at the same speed" > and "For any Java code, I can write Clojure code that does exactly the > same thing just as fast". The difference is in quantification: > universal vs existential.http://en.wikipedia.org/wiki/Quantification#Logic --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---