mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 18:19:03 +00:00
LibJS: Add fast path internal_has_property()
for Array
If array has packed index property storage without holes, we could check if indexed property is present simple by checking if it's less than array's length. Makes the following program go 1.1x faster: ```js function f() { let array = []; for (let i = 0; i < 3_000; i++) { array.push(i); } for (let i = 0; i < 10_000; i++) { array.map(x => x * 2); } } f(); ```
This commit is contained in:
parent
22e0b732db
commit
93cd17db74
Notes:
github-actions[bot]
2025-06-03 21:19:39 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 93cd17db74
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4985
2 changed files with 14 additions and 0 deletions
|
@ -50,6 +50,7 @@ public:
|
|||
virtual ThrowCompletionOr<Optional<PropertyDescriptor>> internal_get_own_property(PropertyKey const&) const override final;
|
||||
virtual ThrowCompletionOr<bool> internal_set(PropertyKey const&, Value value, Value receiver, CacheablePropertyMetadata*, PropertyLookupPhase) override;
|
||||
virtual ThrowCompletionOr<bool> internal_define_own_property(PropertyKey const&, PropertyDescriptor const&, Optional<PropertyDescriptor>* precomputed_get_own_property = nullptr) override final;
|
||||
virtual ThrowCompletionOr<bool> internal_has_property(PropertyKey const&) const override final;
|
||||
virtual ThrowCompletionOr<bool> internal_delete(PropertyKey const&) override;
|
||||
virtual ThrowCompletionOr<GC::RootVector<Value>> internal_own_property_keys() const override final;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue