mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-24 05:25:19 +00:00
- 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.
39 lines
887 B
Dart
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();
|
|
}
|