Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Unified Diff: runtime/lib/growable_array.dart

Issue 337383004: Reduce default capacity of growable list from 4 to 2 elements. Improves performance. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/growable_array.dart
===================================================================
--- runtime/lib/growable_array.dart (revision 37403)
+++ runtime/lib/growable_array.dart (working copy)
@@ -110,8 +110,10 @@
return list;
}
+ static final int _kDefaultCapacity = 2;
+
factory _GrowableList(int length) {
- var data = new _List((length == 0) ? 4 : length);
+ var data = new _List((length == 0) ? _kDefaultCapacity : length);
var result = new _GrowableList<T>.withData(data);
if (length > 0) {
result._setLength(length);
@@ -120,7 +122,7 @@
}
factory _GrowableList.withCapacity(int capacity) {
- var data = new _List((capacity == 0)? 4 : capacity);
+ var data = new _List((capacity == 0)? _kDefaultCapacity : capacity);
return new _GrowableList<T>.withData(data);
}
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698