3 ms·
> Clojure objects are Java Objects, so they must be boxed & unboxed by the JVM. I presume you meant Clojure numbers, because there is no notion of 'boxing' for
by richhickey 18y ago
> Clojure objects are Java Objects, so they must be boxed & unboxed by the JVM.
I presume you meant Clojure numbers, because there is no notion of 'boxing' for reference types. For all non-numeric objects, the Clojure representation is the same as the Java representation. Type-hinted calls to methods of said objects generate the same bytecode as Java, with the same performance.
As far as numbers, recent enhancements ( http://clojure.org/java_interop#primitives http://clojure.org/java_interop#primitives ) allow Clojure to produce primitive arithmetic with the same speed as Java, but with a more-powerful, macro-amenable syntax.
While Clojure offers higher-order constructs with an attendant, but not prohibitive, cost, performance-oriented Clojure code can match the speed of Java.
- icey 18y agoRich, you're seriously some kind of linguistic superhero. Or maybe like the Monty Python version of the Spanish Inquisition. Either way, it's impressive. This: As far as numbers, recent enhancements allow Clojure to produce primitive arithmetic with the same speed as Java, but with a more-powerful, macro-amenable syntax." Just blows me away.
- icey 18y agoEh, it's too late to edit my other post, but the new design at Clojure.org looks great!