const marky = require('marky')
const render = Vue.prototype._render
const update = Vue.prototype._update
const camelize = str => str && Vue.util.camelize(str)
function getName (vm) {
if (!vm.$parent) return 'root'
return (
camelize(vm.$options.name) ||
camelize(vm.$options._componentTag) ||
'anonymous'
) + `-${vm._uid}`
}
Vue.prototype._render = function () {
const id = `render:${getName(this)}`
marky.mark(id)
const vnode = render.apply(this, arguments)
marky.stop(id)
return vnode
}
Vue.prototype._update = function () {
const id = `patch:${getName(this)}`
marky.mark(id)
update.apply(this, arguments)
marky.stop(id)
}