Skip to content

Instantly share code, notes, and snippets.

@swannodette
Created July 26, 2011 04:08
Show Gist options
  • Select an option

  • Save swannodette/1105953 to your computer and use it in GitHub Desktop.

Select an option

Save swannodette/1105953 to your computer and use it in GitHub Desktop.
time.cljs
(defmacro time [expr]
"Evaluates expr and prints the time it took. Returns the value of
expr."
`(let [start# (~'js* "(new Date())")
ret# ~expr]
(prn (str "Elapsed time: " (- (~'js* "(new Date())") start#) " msecs"))
ret#))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment