mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:07:36 +00:00
AK+LibRegex: Add Utf16View::code_point_at and use it in RegexStringView
The current method of iterating through the string to access a code point hurts performance quite badly for very large strings. The test262 test "RegExp/property-escapes/generated/Any.js" previously took 3 hours to complete; this one change brings it down to under 10 seconds.
This commit is contained in:
parent
bed51d856a
commit
510bbcd8e0
3 changed files with 21 additions and 0 deletions
|
@ -87,6 +87,7 @@ public:
|
|||
|
||||
u16 const* data() const { return m_code_units.data(); }
|
||||
u16 code_unit_at(size_t index) const;
|
||||
u32 code_point_at(size_t index) const;
|
||||
|
||||
size_t code_point_offset_of(size_t code_unit_offset) const;
|
||||
size_t code_unit_offset_of(size_t code_point_offset) const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue