Skip to content

Instantly share code, notes, and snippets.

@luxbock
Created April 16, 2015 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luxbock/4b80d17a51b679d645c2 to your computer and use it in GitHub Desktop.
Save luxbock/4b80d17a51b679d645c2 to your computer and use it in GitHub Desktop.
results
(defn C
[n]
(cond
(one? n) 1
(even? n) (C (div n 2))
:else (C (add1 (times 3 n)))))
(defn C* [n]
(cond
(= 1 n) 1
(clojure.core/even? n) (C (quot n 2))
:else (C (inc (* n 3)))))
(>quick-bench (try-with-C C 100))
Evaluation count : 25418142 in 6 samples of 4236357 calls.
Execution time mean : 22.871954 ns
Execution time std-deviation : 0.544709 ns
Execution time lower quantile : 22.130239 ns ( 2.5%)
Execution time upper quantile : 23.456172 ns (97.5%)
Overhead used : 1.521922 ns
WARNING: Final GC required 41.32851466363746 % of runtime
(>quick-bench (try-with-C C* 100))
WARNING: Final GC required 41.70500538426875 % of runtime
Evaluation count : 23958636 in 6 samples of 3993106 calls.
Execution time mean : 24.144272 ns
Execution time std-deviation : 0.343754 ns
Execution time lower quantile : 23.777932 ns ( 2.5%)
Execution time upper quantile : 24.492914 ns (97.5%)
Overhead used : 1.521922 ns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment