mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-19 15:32:31 +00:00
LibJS: Ensure keys vector capacity in Object::internal_own_property_keys
12% improvement on MicroBench/object-keys.js
This commit is contained in:
parent
5ee810f772
commit
27ba216e3f
Notes:
github-actions[bot]
2025-05-15 18:13:17 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 27ba216e3f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4733
1 changed files with 1 additions and 0 deletions
|
@ -1112,6 +1112,7 @@ ThrowCompletionOr<Vector<PropertyKey>> Object::internal_own_property_keys() cons
|
||||||
{
|
{
|
||||||
// 1. Let keys be a new empty List.
|
// 1. Let keys be a new empty List.
|
||||||
Vector<PropertyKey> keys;
|
Vector<PropertyKey> keys;
|
||||||
|
keys.ensure_capacity(m_indexed_properties.real_size() + shape().property_count());
|
||||||
|
|
||||||
// 2. For each own property key P of O such that P is an array index, in ascending numeric index order, do
|
// 2. For each own property key P of O such that P is an array index, in ascending numeric index order, do
|
||||||
for (auto const& entry : m_indexed_properties) {
|
for (auto const& entry : m_indexed_properties) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue