Last active
November 17, 2018 19:55
-
-
Save pbaille/73cddb1d6c4a28767835430d8325d3b5 to your computer and use it in GitHub Desktop.
cljs fns simple forms benchmark
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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