If I had to guess, I'm pretty sure the answer is Clojure, but I'm not sure why. Logically (to me) it seems like ClojureScript should be faster:

Both are "dynamic", but ClojureScript

  • Compiles to JavaScript, running on V8
  • V8 engine is arguably the fastest dynamic language engine there is
  • V8 is written in C

whereas Clojure:

  • Is also dynamic
  • Runs in JVM, which has no built-in dynamic support, so I'm thinking thus JVM has to do whatever V8 is doing too, to enable dynamic support
  • and Java is slower than C

So how could Clojure be faster than ClojureScript? Does "dynamic" mean something different when saying JavaScript is dynamic and Clojure is dynamic? What am I not seeing?

(Of course if ClojureScript is indeed faster, then is the above reasoning correct?)

I guess, what does Clojure compile to....is at least part of the question. I know the JVM part can't just be a plain interpreter (otherwise ClojureScript would be faster), but Clojure can't compile to regular bytecode, as there's no "dynamic" in the JVM. So what's the difference between how ClojureScript is compiled/executed and how Clojure is compiled/excecuted and how plain Java is compiled/executed, and the performance differences implied in each?

Edit
Report