summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibRegex/RegexByteCode.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-10-02 17:37:15 +0200
committerAndreas Kling <kling@serenityos.org>2021-10-02 17:39:38 +0200
commit024367d82e59e66390e8a8fc0f7dd866242438f9 (patch)
tree027c34c8ba5410f795cd45d82668f2e9e696a7b0 /Userland/Libraries/LibRegex/RegexByteCode.cpp
parentae0bdda86e9946e8fc09db0c4dc044b2d975d7fa (diff)
downloadserenity-024367d82e59e66390e8a8fc0f7dd866242438f9.zip
LibJS+AK: Use Vector<u16, 1> for UTF-16 string storage
It's very common to encounter single-character strings in JavaScript on the web. We can make such strings significantly lighter by having a 1-character inline capacity on the Vectors.
Diffstat (limited to 'Userland/Libraries/LibRegex/RegexByteCode.cpp')
-rw-r--r--Userland/Libraries/LibRegex/RegexByteCode.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Userland/Libraries/LibRegex/RegexByteCode.cpp b/Userland/Libraries/LibRegex/RegexByteCode.cpp
index 231c076d10..2b6bc146c7 100644
--- a/Userland/Libraries/LibRegex/RegexByteCode.cpp
+++ b/Userland/Libraries/LibRegex/RegexByteCode.cpp
@@ -470,7 +470,7 @@ ALWAYS_INLINE ExecutionResult OpCode_Compare::execute(MatchInput const& input, M
return ExecutionResult::Failed_ExecuteLowPrioForks;
Optional<String> str;
- Vector<u16> utf16;
+ Vector<u16, 1> utf16;
Vector<u32> data;
data.ensure_capacity(length);
for (size_t i = offset; i < offset + length; ++i)
@@ -557,7 +557,7 @@ ALWAYS_INLINE void OpCode_Compare::compare_char(MatchInput const& input, MatchSt
auto input_view = input.view.substring_view(state.string_position, 1);
Optional<String> str;
- Vector<u16> utf16;
+ Vector<u16, 1> utf16;
auto compare_view = input_view.construct_as_same({ &ch1, 1 }, str, utf16);
bool equal;
if (input.regex_options & AllFlags::Insensitive)