mirror of
https://github.com/penpot/penpot.git
synced 2026-08-01 19:06:18 +00:00
🐛 Fix performance macros disabled in production mode
This commit is contained in:
parent
d933e91c6c
commit
8e8d46b314
@ -45,13 +45,13 @@
|
|||||||
|
|
||||||
(defmacro begin-measure
|
(defmacro begin-measure
|
||||||
[measure-name]
|
[measure-name]
|
||||||
(when enabled?
|
(when (enabled?)
|
||||||
(let [measure-name (str/concat measure-name "::begin")]
|
(let [measure-name (str/concat measure-name "::begin")]
|
||||||
`(.mark js/performance ~measure-name))))
|
`(.mark js/performance ~measure-name))))
|
||||||
|
|
||||||
(defmacro end-measure
|
(defmacro end-measure
|
||||||
[measure-name & [detail]]
|
[measure-name & [detail]]
|
||||||
(when enabled?
|
(when (enabled?)
|
||||||
(let [begin-name (str/concat measure-name "::begin")
|
(let [begin-name (str/concat measure-name "::begin")
|
||||||
end-name (str/concat measure-name "::end")
|
end-name (str/concat measure-name "::end")
|
||||||
detail `(cljs.core/js-obj ~@(mapcat (fn [[k v]] [(name k) v]) detail))
|
detail `(cljs.core/js-obj ~@(mapcat (fn [[k v]] [(name k) v]) detail))
|
||||||
@ -62,7 +62,7 @@
|
|||||||
(defmacro with-measure
|
(defmacro with-measure
|
||||||
"Measures the time of a function call. This should only be called in synchronous functions"
|
"Measures the time of a function call. This should only be called in synchronous functions"
|
||||||
[[measure-name detail] body]
|
[[measure-name detail] body]
|
||||||
(if-not enabled?
|
(if-not (enabled?)
|
||||||
body
|
body
|
||||||
`(let [_# (begin-measure ~measure-name)
|
`(let [_# (begin-measure ~measure-name)
|
||||||
result# ~body
|
result# ~body
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user