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

Unified Diff: runtime/lib/typed_data.dart

Issue 1999793002: Make Iterable.toList more efficient if the length is known. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Avoid iterator for empty list Created 4 years, 7 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 | « runtime/lib/array_patch.dart ('k') | sdk/lib/collection/queue.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/typed_data.dart
diff --git a/runtime/lib/typed_data.dart b/runtime/lib/typed_data.dart
index c4b532f289ee2a0ba144bbf43124be243fac2baf..ad0d89aa2776fa4b18b413640bc9b2aea84f6370 100644
--- a/runtime/lib/typed_data.dart
+++ b/runtime/lib/typed_data.dart
@@ -735,6 +735,14 @@ class _IntListMixin {
}
Iterator<int> get iterator => new _TypedListIterator<int>(this);
+
+ List<int> toList({bool growable: true}) {
+ return new List<int>.from(this, growable: growable);
+ }
+
+ Set<int> toSet() {
+ return new Set<int>.from(this);
+ }
}
@@ -762,6 +770,14 @@ class _DoubleListMixin {
}
Iterator<double> get iterator => new _TypedListIterator<double>(this);
+
+ List<double> toList({bool growable: true}) {
+ return new List<double>.from(this, growable: growable);
+ }
+
+ Set<double> toSet() {
+ return new Set<double>.from(this);
+ }
}
@@ -790,6 +806,14 @@ class _Float32x4ListMixin {
}
Iterator<Float32x4> get iterator => new _TypedListIterator<Float32x4>(this);
+
+ List<Float32x4> toList({bool growable: true}) {
+ return new List<Float32x4>.from(this, growable: growable);
+ }
+
+ Set<Float32x4> toSet() {
+ return new Set<Float32x4>.from(this);
+ }
}
@@ -817,6 +841,14 @@ class _Int32x4ListMixin {
}
Iterator<Int32x4> get iterator => new _TypedListIterator<Int32x4>(this);
+
+ List<Int32x4> toList({bool growable: true}) {
+ return new List<Int32x4>.from(this, growable: growable);
+ }
+
+ Set<Int32x4> toSet() {
+ return new Set<Int32x4>.from(this);
+ }
}
@@ -845,6 +877,14 @@ class _Float64x2ListMixin {
}
Iterator<Float64x2> get iterator => new _TypedListIterator<Float64x2>(this);
+
+ List<Float64x2> toList({bool growable: true}) {
+ return new List<Float64x2>.from(this, growable: growable);
+ }
+
+ Set<Float64x2> toSet() {
+ return new Set<Float64x2>.from(this);
+ }
}
@@ -1146,7 +1186,6 @@ class Uint8List extends _TypedList with _IntListMixin implements List<int>, Type
return Uint8List.BYTES_PER_ELEMENT;
}
-
// Internal utility methods.
Uint8List _createList(int length) {
« no previous file with comments | « runtime/lib/array_patch.dart ('k') | sdk/lib/collection/queue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698