DartBenchmark class
Dart Benchmark
Constructors
- DartBenchmark(String name, BenchmarkCallback execute, {BenchmarkCallback? setup, BenchmarkCallback? cleanup, int count = 100, bool warmup = true})
-
Initialize an instance of
DartBenchMark
. Aname
for the logger and the function to be executed are required. If setup or cleanup are provided they are called before and after the benchmark respectively. execute is called count times, defaults to 100. If warmup is true (default), execute is called 5 times before the benchmark starts. Call run to start the benchmark.
Properties
- cleanup → BenchmarkCallback?
-
Function called after execute, not counted in the result.
final
- count → int
-
How many times execute is called.
final
- execute → BenchmarkCallback
-
Function called to be benchmarked.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- log → Logger
-
Benchmark logger.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- setup → BenchmarkCallback?
-
Function called before execute, not counted in the result.
final
- warmup → bool
-
True to run execute 5 times to warmup.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run(
) → Future< BenchmarkResult> - Start the benchmark. Use log to track down the benchmark progress. If setup, execute or cleanup are futures, they are awaited.
-
runSync(
) → BenchmarkResult - Start the benchmark synchronously. Use log to track down the benchmark progress. setup, execute and cleanup, cannot return a Future.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited