From ad0d377e4c6d9ddfc6d9da7e7e3fe1dd55a7eb38 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 4 Oct 2020 18:04:14 +0200 Subject: [PATCH] LibJS: Pre-size the hash map and vector used in ensure_property_table() --- Libraries/LibJS/Runtime/Shape.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Libraries/LibJS/Runtime/Shape.cpp b/Libraries/LibJS/Runtime/Shape.cpp index ecac57610e..27cdba4654 100644 --- a/Libraries/LibJS/Runtime/Shape.cpp +++ b/Libraries/LibJS/Runtime/Shape.cpp @@ -148,10 +148,11 @@ void Shape::ensure_property_table() const if (m_property_table) return; m_property_table = make>(); + m_property_table->ensure_capacity(m_property_count); DeferGC defer(heap()); - Vector transition_chain; + Vector transition_chain; for (auto* shape = this; shape->m_previous; shape = shape->m_previous) { transition_chain.append(shape); }