mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-07 01:56:38 +00:00
LibJS: Reduce UTF-8 to UTF-16 transcoding when only UTF-16 is wanted
When appending two strings together to form a new string, if both of the strings are already UTF-16, create the new string as UTF-16 as well. This shaves about 0.5 seconds off the following test262 test: RegExp/property-escapes/generated/General_Category_-_Decimal_Number.js
This commit is contained in:
parent
66264f7c2a
commit
b85b8ca350
Notes:
sideshowbarker
2024-07-18 07:08:12 +09:00
Author: https://github.com/trflynn89
Commit: b85b8ca350
Pull-request: https://github.com/SerenityOS/serenity/pull/9320
Reviewed-by: https://github.com/davidot ✅
2 changed files with 17 additions and 0 deletions
|
@ -22,9 +22,11 @@ public:
|
|||
PrimitiveString& operator=(PrimitiveString const&) = delete;
|
||||
|
||||
String const& string() const;
|
||||
bool has_utf8_string() const { return m_has_utf8_string; }
|
||||
|
||||
Utf16String const& utf16_string() const;
|
||||
Utf16View utf16_string_view() const;
|
||||
bool has_utf16_string() const { return m_has_utf16_string; }
|
||||
|
||||
private:
|
||||
virtual const char* class_name() const override { return "PrimitiveString"; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue