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

Unified Diff: sdk/lib/_internal/lib/core_patch.dart

Issue 485043002: Optimize List.toList/.sublist and List.from on lists. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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
Index: sdk/lib/_internal/lib/core_patch.dart
diff --git a/sdk/lib/_internal/lib/core_patch.dart b/sdk/lib/_internal/lib/core_patch.dart
index b6f538ffec9700b8d3e709384b5d42b256ae2fce..5b1f85fd9bd280f9f4de577cf92c72ce62586ed7 100644
--- a/sdk/lib/_internal/lib/core_patch.dart
+++ b/sdk/lib/_internal/lib/core_patch.dart
@@ -253,6 +253,16 @@ class List<E> {
}
return result;
}
+
+ @patch
+ factory List.from(Iterable other, { bool growable: true }) {
+ List<E> list = new List<E>();
+ for (E e in other) {
+ list.add(e);
+ }
+ if (growable) return list;
+ return makeListFixedLength(list);
+ }
}

Powered by Google App Engine
This is Rietveld 408576698