Created
February 4, 2012 16:11
-
-
Save mwmitchell/1738734 to your computer and use it in GitHub Desktop.
clojure time function w/label
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
(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