Welcome! Please see the About page for a little more info on how this works.

0 votes
ago in Clojure by

Very handy in CLJC projects especially to log long running operations. Happy to do PR(s).

  [expr msg]
  `(let [start# (. System (nanoTime))
         ret# ~expr]
     (prn (str msg (/ (double (- (. System (nanoTime)) start#)) 1000000.0) " msecs"))
     ret#))

Even better would be fmt-msg. (format msg-msg (/ (double (- (. System (nanoTime)) start#)) 1000000.0))

Please log in or register to answer this question.

...