Optimizing FCP/LCP by caching raw-view module lookups

lookupView-patch

Implemented now via Map instead of Array.

Time spent on application boot in lookupView - for development instance:

Time saved: ~115 ms

This decreases the time spent inside appendOutletView from 1.083 ms to 946 ms - for development instance.


patch on raw handlebar helpers

Yes, it’s actually a copy-paste with one change: use an inexpensive check for 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;

E.g. renderTopicListItem ultimately triggers many calls of _getPath (another 50-100 ms to save):
Firefox Profiler (callstack filtered to _getPath inside renderTopicListItem)

Maybe the expensive calls to _getPath is something to be optimized in Ember.js and not in Discourse.


And check out Firefox Profiler to get some inside on JavaScript execution: