[benchmarks] Update legacy benchmarks to use the List.filled constructor

The legacy Dart 2.9 benchmarks that used the default List(int size)
constructor are changed to use the equivalent List.filled(size, null)
constructor, because the default List constructor is removed.

Bug: b/280275041
Change-Id: I2813537ae22e19d473abde70d677368940585423
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/304700
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: William Hesse <whesse@google.com>
This commit is contained in:
William Hesse 2023-05-22 14:14:42 +00:00 committed by Commit Queue
parent 783abcd4e8
commit ea5840c2c5
6 changed files with 7 additions and 7 deletions

2
DEPS
View file

@ -55,7 +55,7 @@ vars = {
"co19_2_rev": "ae846ed2a987a2d2dbe4b9e9c68448a21f91ef5b",
# The internal benchmarks to use. See go/dart-benchmarks-internal
"benchmarks_internal_rev": "599aa474a03c37be146f82dfbad85f34f25ffa47",
"benchmarks_internal_rev": "a72da9eed591014535eb47d81185deca39e65ef5",
"checkout_benchmarks_internal": False,
# Checkout Android dependencies only on Mac and Linux.

View file

@ -15,7 +15,7 @@ class MD5Bench extends BenchmarkBase {
List<int> data;
MD5Bench() : super('MD5') {
data = List<int>(size);
data = List<int>.filled(size, null);
for (int i = 0; i < data.length; i++) {
data[i] = i % 256;
}

View file

@ -117,7 +117,7 @@ class Scheduler {
int currentId;
TaskControlBlock list;
List<TaskControlBlock> blocks =
List<TaskControlBlock>(Richards.NUMBER_OF_IDS);
List<TaskControlBlock>.filled(Richards.NUMBER_OF_IDS, null);
/// Add an idle task to this scheduler.
void addIdleTask(int id, int priority, Packet queue, int count) {
@ -428,7 +428,7 @@ class Packet {
int kind; // The type of this packet.
int a1 = 0;
List<int> a2 = List(Richards.DATA_SIZE);
List<int> a2 = List.filled(Richards.DATA_SIZE, null);
Packet(this.link, this.id, this.kind);

View file

@ -15,7 +15,7 @@ class SHA1Bench extends BenchmarkBase {
List<int> data;
SHA1Bench() : super('SHA1') {
data = List<int>(size);
data = List<int>.filled(size, null);
for (int i = 0; i < data.length; i++) {
data[i] = i % 256;
}

View file

@ -16,7 +16,7 @@ class SHA256Bench extends BenchmarkBase {
List<int> data;
SHA256Bench() : super('SHA256') {
data = List<int>(size);
data = List<int>.filled(size, null);
for (int i = 0; i < data.length; i++) {
data[i] = i % 256;
}

View file

@ -45,7 +45,7 @@ class Utf8Encode extends BenchmarkBase {
final String repeatedText = originalText * (size / nRunes).ceil();
final List<int> runes = repeatedText.runes.toList();
final int nChunks = (size < nRunes) ? (nRunes / size).floor() : 1;
benchmarkTextChunks = List<String>(nChunks);
benchmarkTextChunks = List<String>.filled(nChunks, null);
for (int i = 0; i < nChunks; i++) {
final offset = i * size;
benchmarkTextChunks[i] =