mirror of https://github.com/penpot/penpot.git
🎉 Add namespace for performance measuring and debugging tools.
This commit is contained in:
parent
4cf7a48567
commit
affb1480ce
|
|
@ -0,0 +1,19 @@
|
|||
;; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
;;
|
||||
;; Copyright (c) 2015-2019 Andrey Antukh <niwi@niwi.nz>
|
||||
|
||||
(ns uxbox.util.perf
|
||||
"Performance and debugging tools."
|
||||
#?(:cljs (:require-macros [uxbox.util.perf])))
|
||||
|
||||
#?(:clj
|
||||
(defmacro with-measure
|
||||
[name & body]
|
||||
`(let [start# (js/performance.now)
|
||||
res# (do ~@body)
|
||||
end# (js/performance.now)
|
||||
time# (.toFixed (- end# start#) 2)]
|
||||
(println (str "[perf|" ~name "] => " time#))
|
||||
res#)))
|
||||
Loading…
Reference in New Issue