raw-view モジュールルックアップのキャッシュによる FCP/LCP の最適化

lookupView-patch

Array の代わりに Map を使用するように実装しました。

lookupView でのアプリケーション起動時間(開発インスタンスの場合):

  • パッチなし:124 ms
    Firefox Profiler (lookupView にフィルタリングされたコールスタック)

  • パッチあり:9 ms
    Firefox Profiler (lookupView にフィルタリングされたコールスタック)

節約時間:約 115 ms

これにより、appendOutletView での時間が開発インスタンスで 1.083 ms から 946 ms に減少します。


raw handlebar helpers へのパッチ

はい、実際にはコピー&ペーストで、変更点は 1 つだけです。isPath のための安価なチェックを使用します。

      // @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 ms 節約可能):
Firefox Profiler (renderTopicListItem 内の _getPath にフィルタリングされたコールスタック)

高コストな _getPath の呼び出しは、Discourse ではなく Ember.js で最適化されるべきことかもしれません。


また、Firefox Profiler をチェックして、JavaScript の実行に関する洞察を得てください。