Last active
March 1, 2017 12:57
-
-
Save nathanmarz/8e1809bbd3a7632311c2b45ba02eb880 to your computer and use it in GitHub Desktop.
namespace qualify keys of a map benchmark
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
Specter 1.0 | |
Clojure 1.8.0 | |
Mac OSX 10.11.6 | |
Benchmark: namespace qualify keys of a small map (1000000 iterations) | |
Avg(ms) vs best Code | |
243.69 1.00 (setval [MAP-KEYS NAMESPACE] (str *ns*) data) | |
432.11 1.77 (reduce-kv (fn [m k v] (assoc m (keyword (str *ns*) (name k)) v)) {} data) | |
682.69 2.80 (into {} (map (fn [[k v]] [(keyword (str *ns*) (name k)) v])) data) | |
******************************** | |
Benchmark: namespace qualify keys of a large map (1200 iterations) | |
Avg(ms) vs best Code | |
208.69 1.00 (setval [MAP-KEYS NAMESPACE] (str *ns*) data) | |
319.69 1.53 (reduce-kv (fn [m k v] (assoc m (keyword (str *ns*) (name k)) v)) {} data) | |
381.27 1.83 (into {} (map (fn [[k v]] [(keyword (str *ns*) (name k)) v])) data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment