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;
|
return m;
|
||||||
}
|
}
|
||||||
static List<String> keys(Map<String,dynamic> a) {
|
static List<String> keys(Map<String, dynamic> a) {
|
||||||
return a.keys.toList();
|
return a.keys.toList();
|
||||||
}
|
}
|
||||||
static bool isEmpty(Map m) => m.isEmpty;
|
static bool isEmpty(Map m) => m.isEmpty;
|
||||||
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue