mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02: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:
committed by
Andreas Kling
parent
0c3f113e05
commit
b691f4c7af
Notes:
github-actions[bot]
2025-10-05 19:45:30 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/b691f4c7afb Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6401
@@ -1141,7 +1141,7 @@ ThrowCompletionOr<GC::RootVector<Value>> Object::internal_own_property_keys() co
|
||||
// 2. For each own property key P of O such that P is an array index, in ascending numeric index order, do
|
||||
for (auto& entry : m_indexed_properties) {
|
||||
// a. Add P as the last element of keys.
|
||||
keys.append(PrimitiveString::create(vm, String::number(entry.index())));
|
||||
keys.append(PrimitiveString::create_from_unsigned_integer(vm, entry.index()));
|
||||
}
|
||||
|
||||
// 3. For each own property key P of O such that Type(P) is String and P is not an array index, in ascending chronological order of property creation, do
|
||||
|
||||
Reference in New Issue
Block a user