Skip to content

Instantly share code, notes, and snippets.

@mfikes
Last active April 16, 2019 20:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfikes/11f62c9d88c60b6c66da6a29b810dfae to your computer and use it in GitHub Desktop.
Save mfikes/11f62c9d88c60b6c66da6a29b810dfae to your computer and use it in GitHub Desktop.
$ cat src/foo/core.cljs
(ns foo.core)

(prn (time (reduce + (map inc (map inc (range (* 1024 1024)))))))
$ clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.516"}}}' -m cljs.main -O advanced -c foo.core
$ node out/main.js
"Elapsed time: 151.000000 msecs"
549757386752
$ clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.439"}}}' -m cljs.main -O advanced -c foo.core
$ node out/main.js
"Elapsed time: 550.000000 msecs"
549757386752

This can be largely attributed to making the result of range implement the chunked seq abstraction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment