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

Unified Diff: runtime/lib/array_patch.dart

Issue 11882005: Fix performance of array literals (e.g. "[1, 2]"). Improves speed of DeltaBlue. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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/lib/growable_array.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/array_patch.dart
===================================================================
--- runtime/lib/array_patch.dart (revision 16982)
+++ runtime/lib/array_patch.dart (working copy)
@@ -45,12 +45,12 @@
// Factory constructing a mutable List from a parser generated List literal.
// [elements] contains elements that are already type checked.
factory List._fromLiteral(List elements) {
- var list = new List<E>();
- if (elements.length > 0) {
- list._setData(elements);
- list.length = elements.length;
+ if (elements.isEmpty) {
+ return new _GrowableObjectArray<E>(0);
}
- return list;
+ var result = new _GrowableObjectArray<E>.withData(elements);
+ result._setLength(elements.length);
+ return result;
}
static void _throwArgumentError(int length) {
« no previous file with comments | « no previous file | runtime/lib/growable_array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698