perf(dart): Improve Dart ListWrapper#concat

Improve implementation of `ListWrapper#concat` to take advantage of our
knowledge of input list sizes.
This commit is contained in:
Tim Blasi 2015-05-12 14:14:43 -07:00
parent 08f21dbf51
commit 5114411749

View File

@ -130,9 +130,10 @@ class ListWrapper {
l.add(e); l.add(e);
} }
static List concat(List a, List b) { static List concat(List a, List b) {
return [] return new List()
..addAll(a) ..length = a.length + b.length
..addAll(b); ..setRange(0, a.length, a)
..setRange(a.length, a.length + b.length, b);
} }
static bool isList(l) => l is List; static bool isList(l) => l is List;
static void insert(List l, int index, value) { static void insert(List l, int index, value) {