mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 22:18:11 +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:
parent
8f82f6c574
commit
8249280500
1 changed files with 1 additions and 0 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue