Skip to content

Instantly share code, notes, and snippets.

@pbaille
Last active November 17, 2018 19:55
Show Gist options
  • Save pbaille/73cddb1d6c4a28767835430d8325d3b5 to your computer and use it in GitHub Desktop.
Save pbaille/73cddb1d6c4a28767835430d8325d3b5 to your computer and use it in GitHub Desktop.
cljs fns simple forms benchmark
(simple-benchmark [f (fn [a b c] (+ a b c))]
(f 1 2 3)
1000000) ;; 30ms
(simple-benchmark [f (fn [& xs] (apply + xs))]
(f 1 2 3)
1000000) ;; 1700 ms
(simple-benchmark [f (partial apply +)]
(f [1 2 3])
1000000) ;; 1900 ms
(simple-benchmark [f (fn [[a b c]] (+ a b c))]
(f [1 2 3])
1000000) ;; 1300ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment