mirror of
https://github.com/penpot/penpot.git
synced 2025-06-12 04:21:39 +02:00
🎉 Add namespace for performance measuring and debugging tools.
This commit is contained in:
parent
4cf7a48567
commit
affb1480ce
1 changed files with 19 additions and 0 deletions
19
frontend/src/uxbox/util/perf.cljc
Normal file
19
frontend/src/uxbox/util/perf.cljc
Normal file
|
@ -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…
Add table
Add a link
Reference in a new issue