mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 02:59:45 +00:00
LibJS: Skip allocation of temp object for primitive types in Value::get
Previously, `String.prototype.split()` caused the construction of a temporary StringObject when a string primitive was passed as an argument, solely to perform a Symbol.split lookup. This change allows skipping that allocation by looking directly into the prototype of primitive values. As a result, we can avoid ~200000 StringObject allocations in a single test from the Speedometer 2 benchmark. Co-Authored-By: Andreas Kling <andreas@ladybird.org>
This commit is contained in:
parent
057e643a63
commit
a8285f255b
Notes:
github-actions[bot]
2025-03-24 19:39:12 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: a8285f255b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4070
Reviewed-by: https://github.com/awesomekling ✅
Reviewed-by: https://github.com/gmta ✅
2 changed files with 17 additions and 1 deletions
|
@ -105,6 +105,8 @@ public:
|
|||
return StringOrSymbol(as_symbol());
|
||||
}
|
||||
|
||||
bool operator==(PropertyKey const&) const = default;
|
||||
|
||||
private:
|
||||
friend Traits<JS::PropertyKey>;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue