JanetDocsPlaygroundI'm feeling luckyGitHub sign in
(defmacro timeit [& body] # generate unique symbols to use in the macro so they can't conflict with anything used in `body` (with-syms [$t0 $t1] ~(do (def $t0 (os/clock :monotonic :double)) (do ,;body) (def $t1 (os/clock :monotonic :double)) (- $t1 $t0)))) (def time-taken (timeit (os/sleep 0.5))) (printf "Took %.3f seconds" time-taken)