[benchmarks] Add noise to BigIntPrintParse fake results
Change-Id: I1cce5d8066255b489fd4c51395462183cac9728f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227362
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
diff --git a/benchmarks/BigIntParsePrint/dart/BigIntParsePrint.dart b/benchmarks/BigIntParsePrint/dart/BigIntParsePrint.dart
index b3d40c0..3451cc3 100644
--- a/benchmarks/BigIntParsePrint/dart/BigIntParsePrint.dart
+++ b/benchmarks/BigIntParsePrint/dart/BigIntParsePrint.dart
@@ -4,6 +4,8 @@
// ignore_for_file: avoid_function_literals_in_foreach_calls
+import 'dart:math' show Random;
+
import 'package:benchmark_harness/benchmark_harness.dart';
import 'package:fixnum/fixnum.dart';
@@ -240,7 +242,9 @@
class DummyBenchmark extends BenchmarkBase {
DummyBenchmark(String name) : super(name);
@override
- double measure() => 2000 * 1000 * 1.0; // A rate of one run per 2s.
+ // A rate of one run per 2s, with a millisecond of noise. Some variation is
+ // needed for Golem's noise-based filtering and regression detection.
+ double measure() => (2000 + Random().nextDouble() - 0.5) * 1000;
}
/// Create [ParseJsBigIntBenchmark], or a dummy benchmark if JavaScript BigInt
diff --git a/benchmarks/BigIntParsePrint/dart2/BigIntParsePrint.dart b/benchmarks/BigIntParsePrint/dart2/BigIntParsePrint.dart
index db19b68..2ff130d 100644
--- a/benchmarks/BigIntParsePrint/dart2/BigIntParsePrint.dart
+++ b/benchmarks/BigIntParsePrint/dart2/BigIntParsePrint.dart
@@ -6,6 +6,8 @@
// @dart=2.9
+import 'dart:math' show Random;
+
import 'package:benchmark_harness/benchmark_harness.dart';
import 'package:fixnum/fixnum.dart';
@@ -242,7 +244,9 @@
class DummyBenchmark extends BenchmarkBase {
DummyBenchmark(String name) : super(name);
@override
- double measure() => 2000 * 1000 * 1.0; // A rate of one run per 2s.
+ // A rate of one run per 2s, with a millisecond of noise. Some variation is
+ // needed for Golem's noise-based filtering and regression detection.
+ double measure() => (2000 + Random().nextDouble() - 0.5) * 1000;
}
/// Create [ParseJsBigIntBenchmark], or a dummy benchmark if JavaScript BigInt