use custom perf mark impl
This commit is contained in:
parent
e6304cbbf3
commit
e6bf344aec
|
@ -4639,11 +4639,6 @@
|
|||
"object-visit": "1.0.1"
|
||||
}
|
||||
},
|
||||
"marky": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/marky/-/marky-1.2.0.tgz",
|
||||
"integrity": "sha1-lhftZHu76o9F0ZUm2jPexwYG30I="
|
||||
},
|
||||
"math-expression-evaluator": {
|
||||
"version": "1.2.17",
|
||||
"resolved": "https://registry.npmjs.org/math-expression-evaluator/-/math-expression-evaluator-1.2.17.tgz",
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
"intl-relativeformat": "^2.1.0",
|
||||
"lodash": "^4.17.4",
|
||||
"lodash-webpack-plugin": "^0.11.4",
|
||||
"marky": "^1.2.0",
|
||||
"node-fetch": "^1.7.3",
|
||||
"node-sass": "^4.7.2",
|
||||
"npm-run-all": "^4.1.2",
|
||||
|
|
|
@ -1,12 +1,23 @@
|
|||
import { mark as markyMark, stop as markyStop } from 'marky'
|
||||
import noop from 'lodash/noop'
|
||||
|
||||
const enableMarks = process.browser &&
|
||||
performance.mark &&
|
||||
(process.env.NODE_ENV !== 'production' ||
|
||||
new URLSearchParams(location.search).get('marks') === 'true')
|
||||
|
||||
const mark = enableMarks ? markyMark : noop
|
||||
const stop = enableMarks ? markyStop : noop
|
||||
const perf = process.browser && performance
|
||||
|
||||
function doMark(name) {
|
||||
perf.mark(`start ${name}`)
|
||||
}
|
||||
|
||||
function doStop(name) {
|
||||
perf.mark(`end ${name}`)
|
||||
perf.measure(name, `start ${name}`, `end ${name}`)
|
||||
}
|
||||
|
||||
const mark = enableMarks ? doMark : noop
|
||||
const stop = enableMarks ? doStop : noop
|
||||
|
||||
export {
|
||||
mark,
|
||||
|
|
Loading…
Reference in New Issue