From 45e273fa02623de480aa8a92f4d002f500d8c09d Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 13 Mar 2017 23:06:03 +0800 Subject: [PATCH] fix perf measure regression for nested components of the same name (fix #5181) --- src/core/instance/init.js | 6 +++--- src/core/instance/lifecycle.js | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/instance/init.js b/src/core/instance/init.js index 89db67bc984..37f86c86aa8 100644 --- a/src/core/instance/init.js +++ b/src/core/instance/init.js @@ -16,7 +16,7 @@ export function initMixin (Vue: Class) { Vue.prototype._init = function (options?: Object) { /* istanbul ignore if */ if (process.env.NODE_ENV !== 'production' && config.performance && mark) { - mark('init') + mark('vue-perf-init') } const vm: Component = this @@ -57,8 +57,8 @@ export function initMixin (Vue: Class) { /* istanbul ignore if */ if (process.env.NODE_ENV !== 'production' && config.performance && mark) { vm._name = formatComponentName(vm, false) - mark('init end') - measure(`${vm._name} init`, 'init', 'init end') + mark('vue-perf-init-end') + measure(`${vm._name} init`, 'vue-perf-init', 'vue-perf-init-end') } if (vm.$options.el) { diff --git a/src/core/instance/lifecycle.js b/src/core/instance/lifecycle.js index b9ca6f87977..e6e0ed9629a 100644 --- a/src/core/instance/lifecycle.js +++ b/src/core/instance/lifecycle.js @@ -164,8 +164,9 @@ export function mountComponent ( if (process.env.NODE_ENV !== 'production' && config.performance && mark) { updateComponent = () => { const name = vm._name - const startTag = `start ${name}` - const endTag = `end ${name}` + const id = vm._uid + const startTag = `vue-perf-start:${id}` + const endTag = `vue-perf-end:${id}` mark(startTag) const vnode = vm._render()