Skip to content

Instantly share code, notes, and snippets.

@mwmitchell
Created February 4, 2012 16:11
Show Gist options
  • Save mwmitchell/1738734 to your computer and use it in GitHub Desktop.
Save mwmitchell/1738734 to your computer and use it in GitHub Desktop.
clojure time function w/label
(defmacro bm [label & body]
`(let [start# (. System (nanoTime))
result# ~@body]
(prn (str (name ~label)
" elapsed time: "
(/ (double (- (. System (nanoTime)) start#))
1000000.0)
" msecs"))
result#))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment