From 9220c68408d47677d8cd7c548d3a5861365dd24e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 15 Sep 2023 10:45:06 +0200 Subject: [PATCH] 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/ --- Userland/Libraries/LibJS/Heap/Heap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Heap/Heap.cpp b/Userland/Libraries/LibJS/Heap/Heap.cpp index d24d03108e..ba98c73f33 100644 --- a/Userland/Libraries/LibJS/Heap/Heap.cpp +++ b/Userland/Libraries/LibJS/Heap/Heap.cpp @@ -114,7 +114,7 @@ static void add_possible_value(HashMap& possibl } template -static void for_each_cell_among_possible_pointers(HashTable all_live_heap_blocks, HashMap& possible_pointers, Callback callback) +static void for_each_cell_among_possible_pointers(HashTable const& all_live_heap_blocks, HashMap& possible_pointers, Callback callback) { for (auto possible_pointer : possible_pointers.keys()) { if (!possible_pointer)