Ver Fonte

LibWeb: Avoid some heap churn during text splitting

Use Vector capacity while splitting text into chunks (to avoid many
small heap allocations.)
Andreas Kling há 4 anos atrás
pai
commit
1e92081546
1 ficheiros alterados com 1 adições e 1 exclusões
  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) {