Last active
February 17, 2017 00:52
-
-
Save yyx990803/7cfec746bb8cd6ae05e72f30104c0d51 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lol
marky.mark()
.