Skip to content

Instantly share code, notes, and snippets.

@gtrak
Created December 7, 2011 22:16
Show Gist options
  • Save gtrak/1444977 to your computer and use it in GitHub Desktop.
Save gtrak/1444977 to your computer and use it in GitHub Desktop.
atoms speed
user=> (time (let [_count (atom 0)]
(dotimes [a 10000000] (swap! _count inc))))
"Elapsed time: 1292.590795 msecs"
nil
user=> (time (let []
(dotimes [a 10000000] (inc a))))
"Elapsed time: 81.46009 msecs"
nil
user=> (time (let []
(dotimes [a 10000000] nil)))
"Elapsed time: 20.368163 msecs"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment