4 ms·
It's not clear if the 1.1 seconds figure is from the Clojure repl or the ClojureScript repl. They're very different. It says "Clojure" Repl, and in that case i
by lukev 15y ago
It's not clear if the 1.1 seconds figure is from the Clojure repl or the ClojureScript repl. They're very different.
It says "Clojure" Repl, and in that case it would be running directly on the JVM.
- babebridou 15y agoI wondered, too, so I ran the benchmark on a clojure repl on the JVM on my desktop, it timed at 1028ms.
- amouat 15y agoUnfortunately that doesn't tell us a lot, unless you also do each of the other timings.
- babebridou 15y agoYou're right, that was my plan actually, but I got sidetracked by the cygwin beast, sorry. I timed the fib(36) function from within a clojurescript repl inside a clojure jvm repl, and it returned in 86 seconds. Then I timed the generated js function in a Chrome console with a not-so-minor modification so it would compile, it returned in 13 seconds. The modification in question was inlining the generated cljs.core.truth_(predicate) javascript function. The orders of magnitude don't lie though - for what it's worth, a recursive fibonacci implementation in plain java returns in about 125ms (and depending on jvm warm-up, an array-backed computation is a merry jog of 50 to 300µs, but that's completely off-topic) I have yet to setup gambit and clone the clojure-scheme project. I'm really curious though, I like these 800ms that the author advertises.
- takeoutweight 15y agoI was running in the JVM Clojure repl (and not timing JVM startup time). But this is just a single microbenchmark of the author's choosing so we are right to be suspicious of it! Does anyone know of a collection of Clojure benchmarks that stress various aspects of the runtime? (garbage collection, immutable update, polymorphism, etc.)