mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00: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:
parent
391352c112
commit
bf46845819
Notes:
sideshowbarker
2024-07-18 03:43:13 +09:00
Author: https://github.com/awesomekling
Commit: bf46845819
1 changed files with 1 additions and 1 deletions
|
@ -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; });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue