mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 15:16:14 +00:00
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.
This commit is contained in:
@@ -140,7 +140,7 @@ JS_DEFINE_NATIVE_FUNCTION(StringConstructor::from_char_code)
|
||||
// 22.1.2.2 String.fromCodePoint ( ...codePoints ), https://tc39.es/ecma262/#sec-string.fromcodepoint
|
||||
JS_DEFINE_NATIVE_FUNCTION(StringConstructor::from_code_point)
|
||||
{
|
||||
Vector<u16> string;
|
||||
Vector<u16, 1> string;
|
||||
string.ensure_capacity(vm.argument_count()); // This will be an under-estimate if any code point is > 0xffff.
|
||||
|
||||
for (size_t i = 0; i < vm.argument_count(); ++i) {
|
||||
|
||||
Reference in New Issue
Block a user