lookupView-patch
现在通过 Map 实现,而不是 Array。
lookupView 在应用程序启动时花费的时间 - 开发实例:
-
无 patch:124 毫秒
Firefox Profiler (callstack 过滤到lookupView) -
有 patch:9 毫秒
Firefox Profiler (callstack 过滤到lookupView)
节省的时间:约 115 毫秒
这会将 appendOutletView 内部花费的时间从 1.083 毫秒减少到 946 毫秒 - 开发实例。
patch on raw handlebar helpers
是的,实际上是复制粘贴,只有一个更改:使用廉价的 isPath 检查。
// replaces @ember/-internals/utils isPath
// @see: https://github.com/emberjs/ember.js/blob/3537670c14883346e11e841fcb71333384fcbc87/packages/%40ember/-internals/metal/lib/path_cache.ts#L5-L7
// @see: https://github.com/emberjs/ember.js/blob/255a0dd3c7de1187f4a2f61a97cf78bfff8f66a8/packages/%40ember/-internals/glimmer/lib/utils/bindings.ts#L70
let isPath = context.indexOf('.') > -1;
例如,renderTopicListItem 最终会触发许多 _getPath 调用(还可以节省 50-100 毫秒):
Firefox Profiler (renderTopicListItem 内 _getPath 的 callstack 过滤)
也许昂贵的 _getPath 调用应该在 Ember.js 中优化,而不是在 Discourse 中。
并查看 Firefox Profiler 以深入了解 JavaScript 执行: