Skip to content

Commit 45e273f

Browse files
committed
fix perf measure regression for nested components of the same name (fix vuejs#5181)
1 parent d185dd2 commit 45e273f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/core/instance/init.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function initMixin (Vue: Class<Component>) {
1616
Vue.prototype._init = function (options?: Object) {
1717
/* istanbul ignore if */
1818
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
19-
mark('init')
19+
mark('vue-perf-init')
2020
}
2121

2222
const vm: Component = this
@@ -57,8 +57,8 @@ export function initMixin (Vue: Class<Component>) {
5757
/* istanbul ignore if */
5858
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
5959
vm._name = formatComponentName(vm, false)
60-
mark('init end')
61-
measure(`${vm._name} init`, 'init', 'init end')
60+
mark('vue-perf-init-end')
61+
measure(`${vm._name} init`, 'vue-perf-init', 'vue-perf-init-end')
6262
}
6363

6464
if (vm.$options.el) {

src/core/instance/lifecycle.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,9 @@ export function mountComponent (
164164
if (process.env.NODE_ENV !== 'production' && config.performance && mark) {
165165
updateComponent = () => {
166166
const name = vm._name
167-
const startTag = `start ${name}`
168-
const endTag = `end ${name}`
167+
const id = vm._uid
168+
const startTag = `vue-perf-start:${id}`
169+
const endTag = `vue-perf-end:${id}`
169170

170171
mark(startTag)
171172
const vnode = vm._render()

0 commit comments

Comments
 (0)