AK: Shrink Utf16View from 40 bytes to 32 bytes

This ends up making RegexStringView smaller, which means less stuff to
copy when forking in the regex engine.

Thanks to Leon for suggesting the [[no_unique_address]] trick!
This commit is contained in:
Andreas Kling 2025-04-08 20:53:34 +02:00
parent dfade03777
commit 9599742fea

View file

@ -138,7 +138,7 @@ private:
size_t calculate_length_in_code_points() const;
ReadonlySpan<u16> m_code_units;
mutable Optional<size_t> m_length_in_code_points;
[[no_unique_address]] mutable Optional<size_t> m_length_in_code_points;
Endianness m_endianness { Endianness::Host };
};