Index: runtime/lib/string_buffer_patch.dart |
diff --git a/runtime/lib/string_buffer_patch.dart b/runtime/lib/string_buffer_patch.dart |
index d08755082a1c82aac149d3111da98f843a9816c9..401d258da8eb36db420198e7caa26c2106374b8a 100644 |
--- a/runtime/lib/string_buffer_patch.dart |
+++ b/runtime/lib/string_buffer_patch.dart |
@@ -148,7 +148,8 @@ patch class StringBuffer { |
_partsCodeUnitsSinceCompaction += length; |
if (_parts == null) { |
- _parts = [ str ]; |
+ // Empirically this is a good capacity to minimize total bytes allocated. |
+ _parts = new _GrowableList.withCapacity(10)..add(str); |
} else { |
_parts.add(str); |
int partsSinceCompaction = _parts.length - _partsCompactionIndex; |