AsyncBenchmark class abstract
A benchmark whose run is asynchronous. Every run is awaited before the next one starts.
Constructors
- AsyncBenchmark(String name, [int size = 0])
-
Creates a benchmark labeled
namethat processessizeunits per run.const -
AsyncBenchmark.from(String name, Future<
Object?> run(), {int size, Future<void> setup()?, Future<void> teardown()?}) -
Wraps
runas a benchmark, with optional unmeasuredsetupandteardown.factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
The label shown in reports, such as a library or variant name.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → int
-
Units processed per run: bytes for Metric.throughput, or any unit
with Metric.perSecond. Leave it 0 when only time or rate matter.
finalinherited
Methods
-
measure(
[BenchmarkOptions options = BenchmarkOptions.standard]) → Future< Measurement> -
Measures this benchmark with
options.override -
measureDiff(
List< Benchmark> others, {BenchmarkOptions options = BenchmarkOptions.standard, Metric metric = Metric.throughput, bool verify = false, void log(String line) = print}) → Future<List< Measurement> > -
Measures this benchmark together with
others(see measureAll), and logs one line per benchmark comparing it with this one.inherited -
measureRate(
{BenchmarkOptions options = BenchmarkOptions.standard, Metric metric = Metric.throughput, void log(String line) = print}) → Future< Measurement> -
Measures this benchmark and logs one line with the result.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run(
) → Future< Object?> - The code to measure. Return its result, so it cannot be optimized away.
-
setup(
) → Future< void> - Unmeasured code that runs once before measuring.
-
teardown(
) → Future< void> - Unmeasured code that runs once after measuring, even if run throws.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited