Author of http://pixielang.org/ in the city. Welcome to community
On Tue, Jan 17, 2017 at 7:10 PM, Timothy Baldridge <[email protected]> wrote: > > Check link in archive: > >https://web.archive.org/web/20150308140349/http:// > kazimirmajorinc.com/Documents/The-speed-of-eval-in-some- > Lisp-implementations/index.html > > As a Clojure programmer, I find that Clojure code rather...gross. Of > course it's slow, Clojure is optimized completely differently from other > lisps. On my machine the example in the link: > > (time (do (def i 1) > (while (< i 1000000) > (def i (+ i 1)) > (do (def x 0) > (def x (+ x 1)))))) > > Takes 1.1sec to run, but no Clojure programmer in their right mind would > abuse global defs that way. The correct implementation is: > > (time (dotimes [i 1000000] > (+ 0 i))) > > Which completes in .2ms once the JIT warms up (about 4-5 iterations). > > Same with the other example: > > (time (do (def i 1) > (while (< i 1000000) > (def i (+ i 1)) > '(do (def x 0) > (def x (+ x 1)))))) > > 266ms vs: > > (time (dotimes [i 1000000] > '(do (def x 0) > > (def x (+ x 1))))) > > .3 ms with a warm JIT > > > Timothy Baldridge > >
