LibGC: Preallocate space before dumping GC graph

Speeds up the append_gc_graph function by preallocating space.
This change reduces the time taken to dump the GC graph by 4%
on about:blank.
This commit is contained in:
Pavel Shliak 2024-12-14 01:57:31 +04:00 committed by Alexander Kalenik
parent 160c15444b
commit 03ac6e6e87
Notes: github-actions[bot] 2024-12-14 08:07:49 +00:00

View file

@ -119,6 +119,7 @@ public:
m_all_live_heap_blocks.set(&block);
return IterationDecision::Continue;
});
m_work_queue.ensure_capacity(roots.size());
for (auto& [root, root_origin] : roots) {
auto& graph_node = m_graph.ensure(bit_cast<FlatPtr>(root));