summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-18 18:29:32 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-18 19:54:24 +0200
commitbf46845819a1575a41531789bfa11dbaef25e706 (patch)
treea189e5a94381464a661f86173bd0534f0ea486d3 /Userland
parent391352c1121e1709385d8dc47ab81980f24c5a6b (diff)
downloadserenity-bf46845819a1575a41531789bfa11dbaef25e706.zip
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%.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibJS/Lexer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Lexer.cpp b/Userland/Libraries/LibJS/Lexer.cpp
index 3ef63870f3..7b58a84f32 100644
--- a/Userland/Libraries/LibJS/Lexer.cpp
+++ b/Userland/Libraries/LibJS/Lexer.cpp
@@ -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; });