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
Notes: sideshowbarker 2024-07-17 06:51:48 +09:00

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)