discourse/app
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
..
assets PERF: improve `findAllMatches` speed (#22083) 2023-06-13 18:34:28 +02:00
controllers DEV: Fix subfolder setup in dev env (#21983) 2023-06-12 12:49:26 +02:00
helpers UX: Improve login required page (#20847) 2023-03-28 07:09:44 -05:00
jobs FIX: consider users.created_at for inactive cleanup (#21688) 2023-05-23 13:41:23 +05:30
mailers FIX: Likes received count in digest email (#21458) 2023-05-09 19:19:26 +02:00
models DEV: Set limits on custom fields 2023-06-13 11:47:21 +02:00
serializers FIX: Make serialized watched word regex Javascript compatible (#22010) 2023-06-09 10:22:41 +00:00
services PERF: improve `findAllMatches` speed (#22083) 2023-06-13 18:34:28 +02:00
views DEV: add class for static login description section (#22002) 2023-06-08 19:51:41 +05:30