Skip to content

Instantly share code, notes, and snippets.

@amalloy
Created November 30, 2011 19:47
Show Gist options
  • Select an option

  • Save amalloy/1410496 to your computer and use it in GitHub Desktop.

Select an option

Save amalloy/1410496 to your computer and use it in GitHub Desktop.
user> (def data (range (Math/pow 32 3)))
#'user/data
user> (def ju (java.util.HashMap.))
#'user/ju
user> (doseq [x data]
(.put ^java.util.HashMap ju x x))
nil
user> (def cl (into {} (for [x data] [x x])))
#'user/cl
user> (time (dotimes [_ 1e3]
(doseq [x data]
(.get ^java.util.HashMap ju x))))
"Elapsed time: 3013.076968 msecs"
nil
user> (time (dotimes [_ 1e3]
(doseq [x data]
(get cl x))))
"Elapsed time: 8475.282134 msecs"
nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment