Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
vec vs map speed
(use 'criterium.core)
=> nil
(def v1 (vec (range 1000000)))
=> #'user/v1
(def m1 (into {} (map vector (range 1000000) (range 1000000))))
=> #'user/m1
(quick-bench (get m1 71))
Evaluation count : 9861456 in 6 samples of 1643576 calls.
Execution time mean : 60.482667 ns
Execution time std-deviation : 1.681717 ns
Execution time lower quantile : 58.462666 ns ( 2.5%)
Execution time upper quantile : 62.690222 ns (97.5%)
Overhead used : 2.081655 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
(quick-bench (get v1 71))
Evaluation count : 31823724 in 6 samples of 5303954 calls.
Execution time mean : 17.245905 ns
Execution time std-deviation : 0.578525 ns
Execution time lower quantile : 16.519667 ns ( 2.5%)
Execution time upper quantile : 17.975656 ns (97.5%)
Overhead used : 2.081655 ns
=> nil
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.