瀏覽代碼

LibWeb: Avoid some heap churn during text splitting

Use Vector capacity while splitting text into chunks (to avoid many
small heap allocations.)
Andreas Kling 4 年之前
父節點
當前提交
1e92081546
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Libraries/LibWeb/Layout/LayoutText.cpp

+ 1 - 1
Libraries/LibWeb/Layout/LayoutText.cpp

@@ -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) {