mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-21 07:29:53 +00:00
LibJS: Add number-to-string cache for numbers < 1000
We are often forced to convert numbers to strings inside LibJS, e.g when iterating over the property names of an array, but it's also just a very common operation in general. This patch adds a 1000-entry string cache for the numbers 0-999 since those appear to be by far the most common ones we convert.
This commit is contained in:
parent
0c3f113e05
commit
b691f4c7af
Notes:
github-actions[bot]
2025-10-05 19:45:30 +00:00
Author: https://github.com/awesomekling
Commit: b691f4c7af
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6401
12 changed files with 33 additions and 8 deletions
|
@ -245,7 +245,7 @@ JS::ThrowCompletionOr<GC::RootVector<JS::Value>> WindowProxy::internal_own_prope
|
|||
// 5. Repeat while index < maxProperties,
|
||||
for (size_t i = 0; i < max_properties; ++i) {
|
||||
// 1. Add ! ToString(index) as the last element of keys.
|
||||
keys.append(JS::PrimitiveString::create(vm, ByteString::number(i)));
|
||||
keys.append(JS::PrimitiveString::create_from_unsigned_integer(vm, i));
|
||||
|
||||
// 2. Increment index by 1.
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue