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
1 changed files with 5 additions and 4 deletions

View File

@ -82,7 +82,7 @@ class StringMapWrapper {
}
return m;
}
static List<String> keys(Map<String,dynamic> a) {
static List<String> keys(Map<String, dynamic> a) {
return a.keys.toList();
}
static bool isEmpty(Map m) => m.isEmpty;
@ -130,9 +130,10 @@ class ListWrapper {
l.add(e);
}
static List concat(List a, List b) {
return []
..addAll(a)
..addAll(b);
return new List()
..length = a.length + b.length
..setRange(0, a.length, a)
..setRange(a.length, a.length + b.length, b);
}
static bool isList(l) => l is List;
static void insert(List l, int index, value) {