Time body, which should return a map. Merge the execution
time into the result under the :nsec key.
(defmacro with-timing
"Time body, which should return a map. Merge the execution
time into the result under the :nsec key."
[& body]
`(let [start# (System/nanoTime)
result# (do ~@body)]
(assoc result# :nsec (- (System/nanoTime) start#))))
Comments top
No comments for with-timing. Log in to add a comment.