LibJS: Make GetById and GetByValue avoid get_identifier() in common case

We now defer looking up the various identifiers by IdentifierTableIndex
until the last moment. This allows us to avoid the retrieval in common
cases like when a property access is cached.

Knocks a ~12% item off the profile on https://ventrella.com/Clusters/
This commit is contained in:
Andreas Kling 2024-07-09 11:37:06 +02:00 committed by Andreas Kling
commit 509c10d14d
Notes: sideshowbarker 2024-07-17 01:27:18 +09:00
4 changed files with 57 additions and 22 deletions

View file

@ -86,6 +86,8 @@ public:
Vector<DeprecatedFlyString> local_variable_names;
size_t local_index_base { 0 };
Optional<IdentifierTableIndex> length_identifier;
ByteString const& get_string(StringTableIndex index) const { return string_table->get(index); }
DeprecatedFlyString const& get_identifier(IdentifierTableIndex index) const { return identifier_table->get(index); }