Skip to content

Instantly share code, notes, and snippets.

@ibdknox
Created September 23, 2011 23:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ibdknox/1238693 to your computer and use it in GitHub Desktop.
simple speed tests
(ns cljs-test.client)
(defn now []
(. (js/Date.) (getTime)))
(let [nums (doall (range 0 1000000))
start (now)]
(doseq [n nums]
)
(. js/console (log (str "pre-seq: " (- (now) start)))))
(let [start (now)]
(doseq [n (range 0 1000000)]
)
(. js/console (log (str "seq: " (- (now) start)))))
(let [start (now)]
(loop [n 0]
(when (< n 1000000)
(recur (inc n))))
(. js/console (log (str "loop: " (- (now) start)))))
(js* "var c = 0, start = cljs_test.client.now(); for(var i = 0; i < 1000000; i++) { c += i; }; console.log(cljs_test.client.now() - start);")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment