LibRegex: Avoid pointlessly slicing a UTF-16 string for one code unit

This simple change is a nice 9% speedup on the regex test suite :^)
This commit is contained in:
Ali Mohammad Pur 2023-07-14 12:29:30 +03:30 committed by Andreas Kling
parent 17bff999c8
commit fbab9bc330
Notes: sideshowbarker 2024-07-17 07:14:09 +09:00

View file

@ -559,7 +559,7 @@ ALWAYS_INLINE ExecutionResult OpCode_Compare::execute(MatchInput const& input, M
auto range_data = m_bytecode->template spans<4>().slice(offset, count);
offset += count;
auto ch = input.view.substring_view(state.string_position, 1)[0];
auto ch = input.view[state.string_position_in_code_units];
auto const* matching_range = binary_search(range_data, ch, nullptr, [insensitive = input.regex_options & AllFlags::Insensitive](auto needle, CharRange range) {
auto upper_case_needle = needle;