mirror of
https://github.com/dart-lang/sdk
synced 2024-10-02 23:39:19 +00:00
[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:
parent
783abcd4e8
commit
ea5840c2c5
2
DEPS
2
DEPS
|
@ -55,7 +55,7 @@ vars = {
|
||||||
"co19_2_rev": "ae846ed2a987a2d2dbe4b9e9c68448a21f91ef5b",
|
"co19_2_rev": "ae846ed2a987a2d2dbe4b9e9c68448a21f91ef5b",
|
||||||
|
|
||||||
# The internal benchmarks to use. See go/dart-benchmarks-internal
|
# The internal benchmarks to use. See go/dart-benchmarks-internal
|
||||||
"benchmarks_internal_rev": "599aa474a03c37be146f82dfbad85f34f25ffa47",
|
"benchmarks_internal_rev": "a72da9eed591014535eb47d81185deca39e65ef5",
|
||||||
"checkout_benchmarks_internal": False,
|
"checkout_benchmarks_internal": False,
|
||||||
|
|
||||||
# Checkout Android dependencies only on Mac and Linux.
|
# Checkout Android dependencies only on Mac and Linux.
|
||||||
|
|
|
@ -15,7 +15,7 @@ class MD5Bench extends BenchmarkBase {
|
||||||
List<int> data;
|
List<int> data;
|
||||||
|
|
||||||
MD5Bench() : super('MD5') {
|
MD5Bench() : super('MD5') {
|
||||||
data = List<int>(size);
|
data = List<int>.filled(size, null);
|
||||||
for (int i = 0; i < data.length; i++) {
|
for (int i = 0; i < data.length; i++) {
|
||||||
data[i] = i % 256;
|
data[i] = i % 256;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ class Scheduler {
|
||||||
int currentId;
|
int currentId;
|
||||||
TaskControlBlock list;
|
TaskControlBlock list;
|
||||||
List<TaskControlBlock> blocks =
|
List<TaskControlBlock> blocks =
|
||||||
List<TaskControlBlock>(Richards.NUMBER_OF_IDS);
|
List<TaskControlBlock>.filled(Richards.NUMBER_OF_IDS, null);
|
||||||
|
|
||||||
/// Add an idle task to this scheduler.
|
/// Add an idle task to this scheduler.
|
||||||
void addIdleTask(int id, int priority, Packet queue, int count) {
|
void addIdleTask(int id, int priority, Packet queue, int count) {
|
||||||
|
@ -428,7 +428,7 @@ class Packet {
|
||||||
int kind; // The type of this packet.
|
int kind; // The type of this packet.
|
||||||
int a1 = 0;
|
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);
|
Packet(this.link, this.id, this.kind);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class SHA1Bench extends BenchmarkBase {
|
||||||
List<int> data;
|
List<int> data;
|
||||||
|
|
||||||
SHA1Bench() : super('SHA1') {
|
SHA1Bench() : super('SHA1') {
|
||||||
data = List<int>(size);
|
data = List<int>.filled(size, null);
|
||||||
for (int i = 0; i < data.length; i++) {
|
for (int i = 0; i < data.length; i++) {
|
||||||
data[i] = i % 256;
|
data[i] = i % 256;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ class SHA256Bench extends BenchmarkBase {
|
||||||
List<int> data;
|
List<int> data;
|
||||||
|
|
||||||
SHA256Bench() : super('SHA256') {
|
SHA256Bench() : super('SHA256') {
|
||||||
data = List<int>(size);
|
data = List<int>.filled(size, null);
|
||||||
for (int i = 0; i < data.length; i++) {
|
for (int i = 0; i < data.length; i++) {
|
||||||
data[i] = i % 256;
|
data[i] = i % 256;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ class Utf8Encode extends BenchmarkBase {
|
||||||
final String repeatedText = originalText * (size / nRunes).ceil();
|
final String repeatedText = originalText * (size / nRunes).ceil();
|
||||||
final List<int> runes = repeatedText.runes.toList();
|
final List<int> runes = repeatedText.runes.toList();
|
||||||
final int nChunks = (size < nRunes) ? (nRunes / size).floor() : 1;
|
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++) {
|
for (int i = 0; i < nChunks; i++) {
|
||||||
final offset = i * size;
|
final offset = i * size;
|
||||||
benchmarkTextChunks[i] =
|
benchmarkTextChunks[i] =
|
||||||
|
|
Loading…
Reference in a new issue