Files
serenity/Userland/Libraries/LibJS/Runtime/Utf16String.cpp
Andreas Kling 3544236559 LibJS: Cache UTF-16 strings on the VM
We were already caching UTF-8 and byte strings, so let's add a cache
for UTF-16 strings as well. This is particularly profitable whenever we
run regular expressions, since the output of regex execution is a set of
UTF-16 strings.

Note that this is a weak cache like the other JS string caches, meaning
that strings are removed from the cache as they are garbage collected.

This avoids billions of PrimitiveString allocations across a run of WPT,
significantly reducing GC activity.

(cherry picked from commit 206479b2b5fc2641a619eb0d05c1185d869ef844)
2024-10-26 11:39:26 -04:00

3.0 KiB