mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-28 04:08:08 +00:00
LibJS: Use HashMap::ensure_capacity() in enter_scope()
Preallocate some space in the scope variable map. This avoids a bunch of incremental rehashing in the common case.
This commit is contained in:
@@ -92,6 +92,7 @@ Value Interpreter::run(const Statement& statement, ArgumentVector arguments, Sco
|
||||
void Interpreter::enter_scope(const ScopeNode& scope_node, ArgumentVector arguments, ScopeType scope_type)
|
||||
{
|
||||
HashMap<FlyString, Variable> scope_variables_with_declaration_kind;
|
||||
scope_variables_with_declaration_kind.ensure_capacity(16);
|
||||
|
||||
for (auto& declaration : scope_node.variables()) {
|
||||
for (auto& declarator : declaration.declarations()) {
|
||||
|
||||
Reference in New Issue
Block a user