Skip to content

Commit 26f1967

Browse files
committed
always use uid when calling performance.mark (fix #5209)
1 parent 2944515 commit 26f1967

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Diff for: src/core/instance/init.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,18 @@ let uid = 0
1414

1515
export function initMixin (Vue: Class<Component>) {
1616
Vue.prototype._init = function (options?: Object) {
17+
const vm: Component = this
18+
// a uid
19+
vm._uid = uid++
20+
1721
/* istanbul ignore if */
22+
let startTag, endTag
1823
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
19-
mark('vue-perf-init')
24+
startTag = `vue-perf-init:${vm._uid}`
25+
endTag = `vue-perf-end:${vm._uid}`
26+
mark(startTag)
2027
}
2128

22-
const vm: Component = this
23-
// a uid
24-
vm._uid = uid++
2529
// a flag to avoid this being observed
2630
vm._isVue = true
2731
// merge options
@@ -57,8 +61,8 @@ export function initMixin (Vue: Class<Component>) {
5761
/* istanbul ignore if */
5862
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
5963
vm._name = formatComponentName(vm, false)
60-
mark('vue-perf-init-end')
61-
measure(`${vm._name} init`, 'vue-perf-init', 'vue-perf-init-end')
64+
mark(endTag)
65+
measure(`${vm._name} init`, startTag, endTag)
6266
}
6367

6468
if (vm.$options.el) {

0 commit comments

Comments
 (0)