1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +00:00

LibJS: Avoid pointless HashTable copying during GC mark phase

for_each_cell_among_possible_pointers() was taking HashTable by value
instead of by const reference for no reason.

The copying was soaking up ~4% of CPU time while loading https://x.com/
This commit is contained in:
Andreas Kling 2023-09-15 10:45:06 +02:00
parent 56f0b10d14
commit 9220c68408

View file

@ -114,7 +114,7 @@ static void add_possible_value(HashMap<FlatPtr, HeapRootTypeOrLocation>& possibl
}
template<typename Callback>
static void for_each_cell_among_possible_pointers(HashTable<HeapBlock*> all_live_heap_blocks, HashMap<FlatPtr, HeapRootTypeOrLocation>& possible_pointers, Callback callback)
static void for_each_cell_among_possible_pointers(HashTable<HeapBlock*> const& all_live_heap_blocks, HashMap<FlatPtr, HeapRootTypeOrLocation>& possible_pointers, Callback callback)
{
for (auto possible_pointer : possible_pointers.keys()) {
if (!possible_pointer)