Skip to content

Instantly share code, notes, and snippets.

@joinr
Created August 25, 2020 08:58
Show Gist options
  • Save joinr/53351fa2d986f418091e5c812266dceb to your computer and use it in GitHub Desktop.
Save joinr/53351fa2d986f418091e5c812266dceb to your computer and use it in GitHub Desktop.
rrb-vector micro benches
(ns rrbtest.core
(:require [criterium.core :as c]
[clojure.core.rrb-vector :as fv]))
(let [v (vec (range 1000000))]
(c/quick-bench (reduce (fn [_ _] nil) nil v)))
;; Evaluation count : 72 in 6 samples of 12 calls.
;; Execution time mean : 8.588929 ms
;; Execution time std-deviation : 158.450269 µs
;; Execution time lower quantile : 8.394098 ms ( 2.5%)
;; Execution time upper quantile : 8.748043 ms (97.5%)
;; Overhead used : 1.811133 ns
(let [v (fv/vec (range 1000000))]
(c/quick-bench (reduce (fn [_ _] nil) nil v)))
;; Evaluation count : 18 in 6 samples of 3 calls.
;; Execution time mean : 38.650843 ms
;; Execution time std-deviation : 315.823052 µs
;; Execution time lower quantile : 38.322565 ms ( 2.5%)
;; Execution time upper quantile : 39.162136 ms (97.5%)
;; Overhead used : 1.811133 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
(let [v (vec (range 1000000))]
(c/quick-bench (v (rand-int 1000000))))
;; Evaluation count : 4577676 in 6 samples of 762946 calls.
;; Execution time mean : 130.419786 ns
;; Execution time std-deviation : 0.923255 ns
;; Execution time lower quantile : 129.074147 ns ( 2.5%)
;; Execution time upper quantile : 131.406815 ns (97.5%)
;; Overhead used : 1.811133 ns
(let [v (fv/vec (range 1000000))]
(c/quick-bench (v (rand-int 1000000))))
;; Evaluation count : 4491414 in 6 samples of 748569 calls.
;; Execution time mean : 131.903485 ns
;; Execution time std-deviation : 1.528869 ns
;; Execution time lower quantile : 130.147846 ns ( 2.5%)
;; Execution time upper quantile : 133.673757 ns (97.5%)
;; Overhead used : 1.811133 ns
(let [v (vec (range 1000000))]
(c/quick-bench (assoc v (rand-int 1000000) -99)))
;; Evaluation count : 2726832 in 6 samples of 454472 calls.
;; Execution time mean : 220.145372 ns
;; Execution time std-deviation : 1.744551 ns
;; Execution time lower quantile : 218.159955 ns ( 2.5%)
;; Execution time upper quantile : 222.735897 ns (97.5%)
;; Overhead used : 1.811133 ns
(let [v (fv/vec (range 1000000))]
(c/quick-bench (assoc v (rand-int 1000000) -99)))
;; Evaluation count : 2640228 in 6 samples of 440038 calls.
;; Execution time mean : 232.217444 ns
;; Execution time std-deviation : 8.147544 ns
;; Execution time lower quantile : 227.492701 ns ( 2.5%)
;; Execution time upper quantile : 246.245911 ns (97.5%)
;; Overhead used : 1.811133 ns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment