Files
cherrypick/benchmark_cherrypick/lib/cherrypick_benchmark.dart
Sergey Penkovsky 926bbf15f4 refactor(benchmarks): unify benchmark structure, enable CLI parameterization, run matrix, add CSV/JSON/pretty output
- All benchmarks now use a unified base mixin for setup/teardown (BenchmarkWithScope).
- Added args package support: CLI flags for choosing benchmarks, chain counts, nesting depths, output format.
- Support for running benchmarks in matrix mode (multiple parameter sets).
- Machine-readable output: csv, json, pretty-table.
- Loop and naming lint fixes, unused imports removed.
2025-08-06 13:30:30 +03:00

39 lines
887 B
Dart

// ignore: depend_on_referenced_packages
import 'package:benchmark_harness/benchmark_harness.dart';
import 'package:cherrypick/cherrypick.dart';
class AppModule extends Module {
@override
void builder(Scope currentScope) {
bind<FooService>().toProvide(() => FooService());
}
}
// Dummy service for DI
class FooService {}
class RegisterAndResolveBenchmark extends BenchmarkBase {
RegisterAndResolveBenchmark() : super('RegisterAndResolve');
late final Scope scope;
@override
void setup() {
CherryPick.disableGlobalCycleDetection();
CherryPick.disableGlobalCrossScopeCycleDetection();
scope = CherryPick.openRootScope();
scope.installModules([AppModule()]);
}
@override
void run() {
scope.resolve<FooService>();
}
@override
void teardown() => CherryPick.closeRootScope();
}
void main() {
RegisterAndResolveBenchmark().report();
}