mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-14 10:59:24 +02:00
Previously, every set() and remove() call would do a full O(capacity) scan of the underlying hash table to remove dead weak references. This caused significant stalls on pages where the set grew large, as every insertion paid the full cost of scanning the entire table. Fix this by tracking mutations since last prune and only performing the scan after enough operations to amortize the cost. The threshold scales with the table size (minimum 64), so the per-operation cost is O(1) amortized.
3.7 KiB
3.7 KiB