mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibJS+LibWeb: Return Vector<PropertyKey> from internal_own_property_keys
By doing that we avoid lots of `PropertyKey` -> `Value` -> `PropertyKey` transforms, which are quite expensive because of underlying `FlyString` -> `PrimitiveString` -> `FlyString` conversions. 10% improvement on MicroBench/object-keys.js
This commit is contained in:
parent
47569c1714
commit
5ee810f772
Notes:
github-actions[bot]
2025-05-15 18:13:23 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 5ee810f772
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4733
24 changed files with 134 additions and 155 deletions
|
@ -330,12 +330,12 @@ ThrowCompletionOr<bool> Array::internal_delete(PropertyKey const& property_key)
|
|||
}
|
||||
|
||||
// NON-STANDARD: Used to inject the ephemeral length property's key
|
||||
ThrowCompletionOr<GC::RootVector<Value>> Array::internal_own_property_keys() const
|
||||
ThrowCompletionOr<Vector<PropertyKey>> Array::internal_own_property_keys() const
|
||||
{
|
||||
auto& vm = this->vm();
|
||||
auto keys = TRY(Object::internal_own_property_keys());
|
||||
// FIXME: This is pretty expensive, find a better way to do this
|
||||
keys.insert(indexed_properties().real_size(), PrimitiveString::create(vm, vm.names.length.as_string()));
|
||||
keys.insert(indexed_properties().real_size(), PropertyKey { vm.names.length.as_string() });
|
||||
return { move(keys) };
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue