4c20cedd30
Now that I'm able to open the entire SDK in VSC, I'm fixing some of the analysis issues in various files (carefully) without changing their meaning. In this case, I removed unnecessary imports from benchmarks. In regexp_benchmark I ignored one warning which likely would have changed the behavior of the code. BUG=https://github.com/dart-lang/sdk/issues/52419 Change-Id: I9a195a4e45121313bd9f065f2579a165c3fec05b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/303901 Auto-Submit: Eric Seidel <eric@shorebird.dev> Reviewed-by: William Hesse <whesse@google.com> Commit-Queue: William Hesse <whesse@google.com>
34 lines
986 B
Dart
34 lines
986 B
Dart
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'dart:isolate';
|
|
|
|
import 'latency.dart';
|
|
import 'regexp_benchmark.dart';
|
|
|
|
Future<void> main() async {
|
|
final exitPort = ReceivePort();
|
|
final exitFuture = exitPort.first;
|
|
final isolate = await Isolate.spawn(run, null, onExit: exitPort.sendPort);
|
|
|
|
// Measure event loop latency.
|
|
const tickDuration = Duration(milliseconds: 1);
|
|
const numberOfTicks = 8 * 1000; // min 8 seconds.
|
|
final EventLoopLatencyStats stats =
|
|
await measureEventLoopLatency(tickDuration, numberOfTicks);
|
|
|
|
// Kill isolate & wait until it's dead.
|
|
isolate.kill(priority: Isolate.immediate);
|
|
await exitFuture;
|
|
|
|
// Report event loop latency statistics.
|
|
stats.report('EventLoopLatencyRegexp');
|
|
}
|
|
|
|
void run(dynamic msg) {
|
|
while (true) {
|
|
RegexpBenchmark().run();
|
|
}
|
|
}
|