Skip to content

Instantly share code, notes, and snippets.

@puredanger
Created July 19, 2015 14:28
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 puredanger/83f66f157f56bc9db845 to your computer and use it in GitHub Desktop.
Save puredanger/83f66f157f56bc9db845 to your computer and use it in GitHub Desktop.
reduce / mapv tuples
compare perf of reduce and mapv on small vectors - testing worst case of size 6
## 1.7.0
vecperf.bench=> (def v [0 1 2 3 4 5])
#'vecperf.bench/v
vecperf.bench=> (quick-bench (reduce + 0 v))
WARNING: Final GC required 1.508801076780115 % of runtime
WARNING: Final GC required 13.47335649374595 % of runtime
Evaluation count : 11114412 in 6 samples of 1852402 calls.
Execution time mean : 51.601423 ns
Execution time std-deviation : 0.216822 ns
Execution time lower quantile : 51.235501 ns ( 2.5%)
Execution time upper quantile : 51.789039 ns (97.5%)
Overhead used : 1.694155 ns
nil
vecperf.bench=> (quick-bench (mapv inc v))
WARNING: Final GC required 12.66447817796238 % of runtime
Evaluation count : 2854098 in 6 samples of 475683 calls.
Execution time mean : 212.385391 ns
Execution time std-deviation : 2.912659 ns
Execution time lower quantile : 210.619509 ns ( 2.5%)
Execution time upper quantile : 217.391614 ns (97.5%)
Overhead used : 1.694155 ns
Found 1 outliers in 6 samples (16.6667 %)
low-severe 1 (16.6667 %)
Variance from outliers : 13.8889 % Variance is moderately inflated by outliers
nil
## 1.8.0-alpha2
vecperf.bench=> (def v [0 1 2 3 4 5])
#'vecperf.bench/v
vecperf.bench=> (quick-bench (reduce + 0 v))
WARNING: Final GC required 1.337010970382053 % of runtime
WARNING: Final GC required 11.66943380486387 % of runtime
Evaluation count : 4847088 in 6 samples of 807848 calls.
Execution time mean : 122.686174 ns
Execution time std-deviation : 0.833908 ns
Execution time lower quantile : 121.851653 ns ( 2.5%)
Execution time upper quantile : 123.959877 ns (97.5%)
Overhead used : 1.841172 ns
nil
vecperf.bench=> (quick-bench (mapv inc v))
WARNING: Final GC required 11.16403887196258 % of runtime
Evaluation count : 2335674 in 6 samples of 389279 calls.
Execution time mean : 255.759419 ns
Execution time std-deviation : 1.113474 ns
Execution time lower quantile : 254.327285 ns ( 2.5%)
Execution time upper quantile : 257.463531 ns (97.5%)
Overhead used : 1.841172 ns
Found 2 outliers in 6 samples (33.3333 %)
low-severe 1 (16.6667 %)
low-mild 1 (16.6667 %)
Variance from outliers : 13.8889 % Variance is moderately inflated by outliers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment