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:
parent
08f21dbf51
commit
5114411749
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue