LibWeb: Avoid some heap churn during text splitting

Use Vector capacity while splitting text into chunks (to avoid many
small heap allocations.)
This commit is contained in:
Andreas Kling 2020-11-21 12:49:58 +01:00
parent 7d8a9bdb1e
commit 1e92081546
Notes: sideshowbarker 2024-07-19 01:19:47 +09:00

View File

@ -231,7 +231,7 @@ void LayoutText::split_into_lines_by_rules(LayoutBlock& container, LayoutMode la
bool is_break { false };
bool is_all_whitespace { false };
};
Vector<Chunk> chunks;
Vector<Chunk, 128> chunks;
for_each_chunk(
[&](const Utf8View& view, int start, int length, bool is_break, bool is_all_whitespace) {