Created
February 20, 2017 21:23
-
-
Save zcaudate/d23551cb506e36c574ab7e90db38a8c5 to your computer and use it in GitHub Desktop.
record vs map
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
(defrecord Simple [value]) | |
(deftype Basic [value]) | |
(with-out-str | |
(time | |
(dotimes [i 100000000] | |
(set! (Basic. i) :value (* 2 i))))) | |
(with-out-str | |
(time | |
(dotimes [i 100000000] | |
(assoc (Simple. i) :value (* 2 i))))) | |
"\"Elapsed time: 1479.908383 msecs\"\n" | |
(with-out-str | |
(time | |
(dotimes [i 100000000] | |
(assoc {:value i} :value (* 2 i))))) | |
"\"Elapsed time: 3889.025598 msecs\"\n" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment