A Clojure/script stopwatch implementation.
Uses System/nanoTime on the JVM.
Uses the most precise mechanism depending on the Javascript runtime:
Add the following dependency to your project.clj or build.boot:
[dm3/stopwatch "0.1.1"]then require the namespace:
(require '[stopwatch.core :as stopwatch])Using synchronously:
(let [elapsed (stopwatch/start)]
(do-work)
(println "Elapsed: " (elapsed) "ns"))and asynchronously, using core.async:
(let [elapsed (stopwatch/start)]
(go
(<! (do-work))
(println "Elapsed: " (elapsed) "ns")))Copyright © 2017 Vadim Platonov
Distributed under the MIT License.
