mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
LibJS: Pre-calculate the number of bindings for function environments
We can use `ensure_capacity` for binding vectors if we know their sizes in advance. This ensures that binding vectors aren't reallocated during the `function_declaration_instantiation` execution. With this change, `try_grow_capacity()` and `shrink_to_fit()` are no longer visible in the `function_declaration_instantiation()` profiles when running React-Redux-TodoMVC from Speedometer.
This commit is contained in:
parent
98f479318a
commit
42e9dfedc2
3 changed files with 78 additions and 0 deletions
|
@ -152,6 +152,10 @@ private:
|
|||
bool m_arguments_object_needed { false };
|
||||
Vector<VariableNameToInitialize> m_var_names_to_initialize_binding;
|
||||
Vector<DeprecatedFlyString> m_function_names_to_initialize_binding;
|
||||
|
||||
size_t m_function_environment_bindings_count { 0 };
|
||||
size_t m_var_environment_bindings_count { 0 };
|
||||
size_t m_lex_environment_bindings_count { 0 };
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue