discourse/app/assets/javascripts
Régis Hanol 4cb3412a56
PERF: improve findAllMatches speed (#22083)
When we introduced unicode support in the regular expressions used in watched words (9a27803) we didn't realize the cost adding the `u` flag would be.

Turns out, it's pretty bad when you have lots of regular expressions to test. A customer had slightly less than 200 watched words, and it would freeze the browser for about 2s on the first check of those regular expressions (roughly 10ms per regular expression).

This commit introduces a new field (`word`) to the serialized watched words which is then converted to a very fast and cheap regular expression on the client-side. We use that regexp to quicly check whether a matcher is even worth trying so that we don't incure the cost of compiling the expensive unicode regexp.

This commit also busts the `WordWatcher` cache since we added a new field to be serialized.

One nice side effect of using `matchAll` instead of a `while / exec` loop is that the likeliness of having a bad regexp matching infinitely is vastly reduced 🙌
2023-06-13 18:34:28 +02:00
..
admin Build(deps-dev): Bump @babel/core in /app/assets/javascripts (#22026) 2023-06-12 16:50:43 +02:00
bootstrap-json DEV: Fix subfolder setup in dev env (#21983) 2023-06-12 12:49:26 +02:00
confirm-new-email DEV: Add error message styling (#21225) 2023-04-25 08:40:18 -04:00
dialog-holder Build(deps): Bump webpack in /app/assets/javascripts (#21987) 2023-06-12 13:59:23 +02:00
discourse PERF: improve findAllMatches speed (#22083) 2023-06-13 18:34:28 +02:00
discourse-common Build(deps-dev): Bump @babel/core in /app/assets/javascripts (#22026) 2023-06-12 16:50:43 +02:00
discourse-hbr Build(deps-dev): Bump @babel/core in /app/assets/javascripts (#22026) 2023-06-12 16:50:43 +02:00
discourse-plugins Build(deps-dev): Bump @babel/core in /app/assets/javascripts (#22026) 2023-06-12 16:50:43 +02:00
discourse-widget-hbs Build(deps-dev): Bump @babel/core in /app/assets/javascripts (#22026) 2023-06-12 16:50:43 +02:00
docs
ember-addons
ember-cli-progress-ci
ember-production-deprecations DEV: Include ember deprecation messages in production builds (#20587) 2023-03-10 10:37:28 +00:00
locales UX/DEV: Review queue redesign fixes (#20239) 2023-03-02 16:40:53 +01:00
patches DEV: Update ember-cli to 4.12.0 (#21074) 2023-04-19 12:58:29 +02:00
pretty-text PERF: improve findAllMatches speed (#22083) 2023-06-13 18:34:28 +02:00
select-kit Build(deps-dev): Bump @babel/core in /app/assets/javascripts (#22026) 2023-06-12 16:50:43 +02:00
truth-helpers Build(deps-dev): Bump @babel/core in /app/assets/javascripts (#22026) 2023-06-12 16:50:43 +02:00
wizard Build(deps-dev): Bump @babel/core in /app/assets/javascripts (#22026) 2023-06-12 16:50:43 +02:00
.licensee.json Revert "DEV: Merge package.json files (#21172)" (#21182) 2023-04-20 14:57:40 +02:00
.npmrc
discourse-js-processor.js DEV: Update ember-cli-htmlbars to 6.2.0 (#20467) 2023-02-27 18:43:28 +01:00
handlebars-shim.js
package.json DEV: Move app build-time dependencies to devDependencies (#21310) 2023-05-03 09:25:13 +01:00
polyfills.js Drop support for iOS < 15.7 (#19847) 2023-01-16 17:28:59 +00:00
service-worker.js.erb PERF: Improve workbox loading strategy (#22019) 2023-06-09 11:14:11 +01:00
yarn.lock Build(deps-dev): Bump terser in /app/assets/javascripts (#22074) 2023-06-13 01:31:36 +02:00