Time spent in the 'find module with suffix' portion of our `customResolve` function were adding up to around 100ms-150ms when booting the app. This time is spread over 150+ calls, so it's not immediately obvious in flamegraphs. This commit implements a (reversed) [Trie](https://en.wikipedia.org/wiki/Trie) which enables fast suffix-based lookups on a list of strings. In my tests, this requires < 5ms to initialize, and brings the cumulative 'find module with suffix' time down to `< 5ms`. This corresponds to a ~100ms improvement in LCP metrics in my browser. The only behavior change is to remove support for module filenames which are **not** dasherized. I haven't found any core/theme/plugin modules which are not dasherized in their filenames. |
||
|---|---|---|
| .. | ||
| allow-lister-test.js | ||
| bookmark-test.js | ||
| category-badge-test.js | ||
| click-track-edit-history-test.js | ||
| click-track-profile-page-test.js | ||
| click-track-test.js | ||
| computed-test.js | ||
| download-calendar-test.js | ||
| emoji-store-test.js | ||
| emoji-test.js | ||
| formatter-test.js | ||
| get-url-test.js | ||
| highlight-search-test.js | ||
| i18n-test.js | ||
| icon-library-test.js | ||
| key-value-store-test.js | ||
| keyboard-shortcuts-test.js | ||
| link-lookup-test.js | ||
| link-mentions-test.js | ||
| load-script-test.js | ||
| oneboxer-test.js | ||
| parse-bbcode-tag-test.js | ||
| preload-store-test.js | ||
| pretty-text-test.js | ||
| sanitizer-test.js | ||
| search-test.js | ||
| sharing-test.js | ||
| suffix-trie-test.js | ||
| text-direction-test.js | ||
| time-utils-test.js | ||
| timeframes-builder-test.js | ||
| to-markdown-test.js | ||
| upload-short-url-test.js | ||
| uploads-test.js | ||
| uppy-checksum-plugin-test.js | ||
| uppy-media-optimization-plugin-test.js | ||
| url-test.js | ||
| user-search-test.js | ||
| utilities-test.js | ||