Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Variation on Clojure's time macro but also printing the expression that is being timed
(defmacro timed [expr]
`(let [start# (. System (nanoTime))
ret# ~expr]
(prn (str ~(str expr) " elapsed time: " (/ (double (- (. System (nanoTime)) start#)) 1000000.0) " msecs"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.