From feef542c73d5aa8448437a5290f67fe94c6972c1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 4 Oct 2023 16:12:46 +0200 Subject: [PATCH] LibJS: Don't worry about deduplicating bytecode string tables The strings will get deduplicated when actually turned into PrimitiveString objects at runtime anyway, and keeping the string tables deduplicated was actually wasting a lot of time. 4.4% speed-up on Kraken/stanford-crypto-ccm.js :^) --- Userland/Libraries/LibJS/Bytecode/IdentifierTable.cpp | 4 ---- Userland/Libraries/LibJS/Bytecode/StringTable.cpp | 4 ---- 2 files changed, 8 deletions(-) diff --git a/Userland/Libraries/LibJS/Bytecode/IdentifierTable.cpp b/Userland/Libraries/LibJS/Bytecode/IdentifierTable.cpp index 95fed273a2..7347a90c87 100644 --- a/Userland/Libraries/LibJS/Bytecode/IdentifierTable.cpp +++ b/Userland/Libraries/LibJS/Bytecode/IdentifierTable.cpp @@ -10,10 +10,6 @@ namespace JS::Bytecode { IdentifierTableIndex IdentifierTable::insert(DeprecatedFlyString string) { - for (size_t i = 0; i < m_identifiers.size(); i++) { - if (m_identifiers[i] == string) - return i; - } m_identifiers.append(move(string)); return m_identifiers.size() - 1; } diff --git a/Userland/Libraries/LibJS/Bytecode/StringTable.cpp b/Userland/Libraries/LibJS/Bytecode/StringTable.cpp index a369a6c53a..e42f41417d 100644 --- a/Userland/Libraries/LibJS/Bytecode/StringTable.cpp +++ b/Userland/Libraries/LibJS/Bytecode/StringTable.cpp @@ -10,10 +10,6 @@ namespace JS::Bytecode { StringTableIndex StringTable::insert(DeprecatedString string) { - for (size_t i = 0; i < m_strings.size(); i++) { - if (m_strings[i] == string) - return i; - } m_strings.append(move(string)); return m_strings.size() - 1; }