mirror of
https://github.com/SerenityOS/serenity
synced 2026-05-05 22:52:10 +02:00
LibJS: Avoid a temporary AK::String when lexing already-seen identifiers
By using the FlyString(StringView) constructor instead of the FlyString(String) one, we can dodge a temporary String construction. This improves parsing time on a large chunk of JS by ~1.6%.
This commit is contained in:
@@ -614,7 +614,7 @@ Token Lexer::next()
|
||||
code_point = is_identifier_middle(identifier_length);
|
||||
} while (code_point.has_value());
|
||||
|
||||
identifier = builder.build();
|
||||
identifier = builder.string_view();
|
||||
m_parsed_identifiers->identifiers.set(*identifier);
|
||||
|
||||
auto it = s_keywords.find(identifier->hash(), [&](auto& entry) { return entry.key == identifier; });
|
||||
|
||||
Reference in New Issue
Block a user