Skip to content

Instantly share code, notes, and snippets.

@zcaudate
Created February 20, 2017 21:23
Show Gist options
  • Save zcaudate/d23551cb506e36c574ab7e90db38a8c5 to your computer and use it in GitHub Desktop.
Save zcaudate/d23551cb506e36c574ab7e90db38a8c5 to your computer and use it in GitHub Desktop.
record vs map
(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