我有一个页面,它的渲染速度肯定比其他页面慢。它不做任何远程调用。速度足够慢,以至于用户提到,与其他页面呈现的速度相比,它感觉“很慢”。有什么策略可以分析这个渲染,以便我可以优化它?
发布于 2013-03-28 10:43:50
通常,我做的第一件事就是记录绑定。通常,绑定更新的触发频率比您预期的更高,这真的会减慢速度。
Ember.LOG_BINDINGS = true除此之外,您可能希望使用Ember Instrumentation模块。关于这项技术here有一篇很棒的博客文章,但它的基本思想是:
Ember.subscribe('render', {
before: function(name, start, payload){
return start
},
after: function(name, end, payload, start){
var duration = Math.round(end - start)
var template = payload.template
if (template){ // this is to filter out anonymous templates
console.log('rendered', template, 'took', duration, 'ms')
}
}
})https://stackoverflow.com/questions/15673161
复制相似问题