lumo icon indicating copy to clipboard operation
lumo copied to clipboard

Execution speed of lumo compared to Clojure

Open bender647 opened this issue 2 years ago • 0 comments

This year I used lumo for Advent of Code, as I'm familiar with Javascript (and not Java), and like the philosophy of starting up quickly and having no clutter in your working directory.

However, there were a couple problems I was stuck on, trying to get my execution times down. For kicks, I tried running the same scripts in Clojure (on the JVM) and saw 7X speed improvement in the cases I tried.

I wanted to check if this was to be expected.

Just a quick test, using the latest Lumo pre-built linux binary:

Lumo 1.10.1
ClojureScript 1.10.520
Node.js v11.13.0
 Docs: (doc function-name-here)
       (find-doc "part-of-name-here")
 Source: (source function-name-here)
 Exit: Control+D or :cljs/quit or exit

cljs.user=> (time (dotimes [c 10000000] (sort [2 4 1 8 7 9])))
"Elapsed time: 30364.978216 msecs"
nil
cljs.user=> (time (dotimes [c 10000000] (sort [2 4 1 8 7 9])))
"Elapsed time: 30977.397318 msecs"

Latest downloaded Clojure (usually the first initial run times will be slower, then they speed up significantly and stay fast):

Clojure 1.10.3
user=> (time (dotimes [c 10000000] (sort [2 4 1 8 7 9])))
"Elapsed time: 5548.512002 msecs"
nil
user=> (time (dotimes [c 10000000] (sort [2 4 1 8 7 9])))
"Elapsed time: 6451.64772 msecs"
nil
user=> (time (dotimes [c 10000000] (sort [2 4 1 8 7 9])))
"Elapsed time: 11067.288896 msecs"
nil
user=> (time (dotimes [c 10000000] (sort [2 4 1 8 7 9])))
"Elapsed time: 3167.670393 msecs"
nil
user=> (time (dotimes [c 10000000] (sort [2 4 1 8 7 9])))
"Elapsed time: 3114.163477 msecs"
nil
user=> (time (dotimes [c 10000000] (sort [2 4 1 8 7 9])))
"Elapsed time: 3131.076725 msecs"
nil

And org.clojure/clojurescript:

Waiting for browser to connect to http://localhost:9000 ...
ClojureScript 1.10.758
cljs.user=> (time (dotimes [c 10000000] (sort [2 4 1 8 7 9])))
"Elapsed time: 20111.500000 msecs"
nil
cljs.user=> (time (dotimes [c 10000000] (sort [2 4 1 8 7 9])))
"Elapsed time: 19918.300000 msecs"
nil
cljs.user=> (time (dotimes [c 10000000] (sort [2 4 1 8 7 9])))
"Elapsed time: 20111.500000 msecs"
nil

I'm wondering perhaps if there is something I'm doing wrong (like not compiling the source?)

bender647 avatar Jan 25 '22 19:01 bender647