discourse/spec
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
..
fabricators UX: First pass at edit categories navigation modal for sidebar (#21963) 2023-06-07 12:09:30 +08:00
fixtures UX: Remove 'Create Topics' notice (#21958) 2023-06-08 22:30:26 +03:00
helpers DEV: Replace #pluck_first freedom patch with AR #pick in core (#19893) 2023-02-13 12:39:45 +08:00
import_export DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00
initializers DEV: Fix test (#22018) 2023-06-08 16:12:13 -05:00
integration FIX: Handle all UTF-8 characters (#21344) 2023-05-15 12:45:04 +03:00
integrity DEV: Remove renderTemplate from the styleguide (#21660) 2023-05-25 11:22:36 +02:00
jobs FIX: consider users.created_at for inactive cleanup (#21688) 2023-05-23 13:41:23 +05:30
lib FEATURE: Add new site setting type for tag-group lists (#21993) 2023-06-09 11:02:55 -04:00
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
multisite DEV: Add plugin hook for transforming site setting defaults (#20941) 2023-04-05 12:28:16 +01:00
requests FIX: Make serialized watched word regex Javascript compatible (#22010) 2023-06-09 10:22:41 +00:00
script/import_scripts DEV: Correct syntax_tree violations 2023-02-02 13:03:11 +00:00
serializers FIX: Hide delete button to invite as user are unable to delete anyway (#21884) 2023-06-06 12:24:19 +08:00
services PERF: improve findAllMatches speed (#22083) 2023-06-13 18:34:28 +02:00
support DEV: Set limits on custom fields 2023-06-13 11:47:21 +02:00
system DEV: Try to de-flake topic page specs (#22065) 2023-06-13 11:05:19 +02:00
tasks DEV: Capture output in hashtags spec (#20773) 2023-03-23 11:47:14 +10:00
views FEATURE: add category name in articleSection meta tag for schema. (#21004) 2023-04-06 23:30:19 +05:30
rails_helper.rb FIX: TOC anchors in a subfolder setup (#21985) 2023-06-12 13:59:54 +02:00
regenerate_swagger_docs DEV: Add API docs for uploads and API doc watcher (#15387) 2021-12-23 08:40:15 +10:00
swagger_helper.rb DEV: Apply syntax_tree formatting to spec/* 2023-01-09 11:49:28 +00:00