Last active
March 26, 2017 02:33
-
-
Save chpill/6e78d2753618ab3f04991c129a937e74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn single-return-transducer | |
"Dummy transducer that simply returns the value given to it, | |
ignoring any accumulated value" | |
([] :initial-value-to-be-ignored) | |
([final-value] final-value) | |
([initial-value v] v)) | |
(defn using-xform--hazard-edition [chunks] | |
(transduce (comp (halt-when error?) | |
cat | |
(x/by-key :a x/count) | |
(x/into {})) | |
single-return-transducer | |
chunks)) | |
(using-xform--hazard-edition chunks) | |
=> {0 3330, 1 3330, 2 3330} | |
(using-xform--hazard-edition mini-chunks-with-error) | |
=> {:error "Something terrible has happened!"} | |
(criterium/bench (using-xform--hazard-edition chunks)) | |
" | |
Evaluation count : 156900 in 60 samples of 2615 calls. | |
Execution time mean : 387.491867 µs | |
Execution time std-deviation : 17.182729 µs | |
Execution time lower quantile : 367.187856 µs ( 2.5%) | |
Execution time upper quantile : 421.113467 µs (97.5%) | |
Overhead used : 1.468563 ns | |
Found 2 outliers in 60 samples (3.3333 %) | |
low-severe 1 (1.6667 %) | |
low-mild 1 (1.6667 %) | |
Variance from outliers : 30.3386 % Variance is moderately inflated by outliers | |
" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment