clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
borkdude 2021-07-03T21:01:47.163600Z

Why is the upper expression roughly twice as fast in chrome?

(time (dotimes [i 10000000] ((fn [_]) :foo)))
(time (let [x (fn [_])] (dotimes [i 10000000] (x :foo))))
I ran this in http://app.klipse.tech/

Aron 2021-07-04T07:41:57.165700Z

don't microbenchmark javascript jit compilers

jkxyz 2021-07-03T21:26:59.163800Z

I have very little knowledge of compiler optimizations, but maybe because in the first expression, the closure of the immediately-invoked function is the same as the caller, so the JS compiler knows it can elide code which would modify the stack before entering the function

borkdude 2021-07-03T21:35:46.164100Z

could be!