Created
April 29, 2014 06:59
-
-
Save AlexBaranosky/11392546 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
(def commonly-used-str->keyword | |
{"precise" :precise | |
"messy" :messy | |
"active" :active | |
"control" :control}) | |
(defn fast-keywordize [k] | |
(get commonly-used-str->keyword k)) | |
(defn third-way [k] | |
(case k | |
"precise" :precise | |
"messy" :messy | |
"active" :active | |
"control" :control)) | |
(comment | |
(quick-bench | |
(do | |
(commonly-used-str->keyword "precise") | |
(commonly-used-str->keyword "messy") | |
(commonly-used-str->keyword "active") | |
(commonly-used-str->keyword "control"))) | |
WARNING: Final GC required 75.52538636612081 % of runtime | |
Evaluation count : 3064998 in 6 samples of 510833 calls. | |
Execution time mean : 190.757370 ns | |
Execution time std-deviation : 2.996956 ns | |
Execution time lower quantile : 187.634693 ns ( 2.5%) | |
Execution time upper quantile : 195.547993 ns (97.5%) | |
Overhead used : 8.709319 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 | |
(quick-bench | |
(do | |
(fast-keywordize "precise") | |
(fast-keywordize "messy") | |
(fast-keywordize "active") | |
(fast-keywordize "control"))) | |
WARNING: Final GC required 76.45870578120596 % of runtime | |
Evaluation count : 2928858 in 6 samples of 488143 calls. | |
Execution time mean : 195.451484 ns | |
Execution time std-deviation : 1.086166 ns | |
Execution time lower quantile : 194.378711 ns ( 2.5%) | |
Execution time upper quantile : 197.043913 ns (97.5%) | |
Overhead used : 8.709319 ns | |
(quick-bench | |
(do | |
(third-way "precise") | |
(third-way "messy") | |
(third-way "active") | |
(third-way "control"))) | |
WARNING: Final GC required 88.42201158444317 % of runtime | |
Evaluation count : 13368582 in 6 samples of 2228097 calls. | |
Execution time mean : 36.474830 ns | |
Execution time std-deviation : 0.273833 ns | |
Execution time lower quantile : 36.082268 ns ( 2.5%) | |
Execution time upper quantile : 36.783427 ns (97.5%) | |
Overhead used : 8.709319 ns | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment