Skip to content

Instantly share code, notes, and snippets.

@luxbock

luxbock/results.clj

Created Apr 16, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.