mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 22:52:22 +02:00
The set of all prototype shapes was a process-global static, which meant that Shape::invalidate_all_prototype_chains_leading_to_this() had to iterate over every prototype shape from every Realm in the process. This was catastrophic for pages that load many SVG-as-img resources, since each SVG image creates its own Realm with a full set of JS intrinsics and web prototypes. With N SVG images, each adding ~100 properties to their ObjectPrototype, this became O(N * 100 * M) where M is the total number of prototype shapes across all Realms. Since prototype chains never cross Realm boundaries, we can scope the tracking to each Realm, making the invalidation cost independent of the number of Realms in the process.
13 KiB
13 KiB