mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-25 22:36:44 +00:00
fix: universal benchmarks and DI registration; proper named binding; robust override support for cherrypick and get_it; improved CLI args
This commit is contained in:
@@ -11,6 +11,7 @@ import 'runner.dart';
|
||||
import 'package:benchmark_cherrypick/benchmarks/universal_chain_benchmark.dart';
|
||||
import 'package:benchmark_cherrypick/benchmarks/universal_chain_async_benchmark.dart';
|
||||
import 'package:benchmark_cherrypick/di_adapters/cherrypick_adapter.dart';
|
||||
import 'package:benchmark_cherrypick/di_adapters/get_it_adapter.dart';
|
||||
|
||||
/// Command-line interface (CLI) runner for benchmarks.
|
||||
///
|
||||
@@ -28,8 +29,8 @@ class BenchmarkCliRunner {
|
||||
for (final c in config.chainCounts) {
|
||||
for (final d in config.nestDepths) {
|
||||
BenchmarkResult benchResult;
|
||||
final di = config.di == 'getit' ? GetItAdapter() : CherrypickDIAdapter();
|
||||
if (scenario == UniversalScenario.asyncChain) {
|
||||
final di = CherrypickDIAdapter();
|
||||
final benchAsync = UniversalChainAsyncBenchmark(di,
|
||||
chainCount: c, nestingDepth: d, mode: mode,
|
||||
);
|
||||
@@ -39,7 +40,6 @@ class BenchmarkCliRunner {
|
||||
repeats: config.repeats,
|
||||
);
|
||||
} else {
|
||||
final di = CherrypickDIAdapter();
|
||||
final benchSync = UniversalChainBenchmark(di,
|
||||
chainCount: c, nestingDepth: d, mode: mode, scenario: scenario,
|
||||
);
|
||||
|
||||
@@ -81,6 +81,8 @@ class BenchmarkCliConfig {
|
||||
final int warmups;
|
||||
/// Output report format.
|
||||
final String format;
|
||||
/// Name of DI implementation ("cherrypick" or "getit")
|
||||
final String di;
|
||||
BenchmarkCliConfig({
|
||||
required this.benchesToRun,
|
||||
required this.chainCounts,
|
||||
@@ -88,6 +90,7 @@ class BenchmarkCliConfig {
|
||||
required this.repeats,
|
||||
required this.warmups,
|
||||
required this.format,
|
||||
required this.di,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -101,6 +104,7 @@ BenchmarkCliConfig parseBenchmarkCli(List<String> args) {
|
||||
..addOption('repeat', abbr: 'r', defaultsTo: '2')
|
||||
..addOption('warmup', abbr: 'w', defaultsTo: '1')
|
||||
..addOption('format', abbr: 'f', defaultsTo: 'pretty')
|
||||
..addOption('di', defaultsTo: 'cherrypick', help: 'DI implementation: cherrypick or getit')
|
||||
..addFlag('help', abbr: 'h', negatable: false, help: 'Show help');
|
||||
final result = parser.parse(args);
|
||||
if (result['help'] == true) {
|
||||
@@ -120,5 +124,6 @@ BenchmarkCliConfig parseBenchmarkCli(List<String> args) {
|
||||
repeats: int.tryParse(result['repeat'] as String? ?? "") ?? 2,
|
||||
warmups: int.tryParse(result['warmup'] as String? ?? "") ?? 1,
|
||||
format: result['format'] as String,
|
||||
di: result['di'] as String? ?? 'cherrypick',
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user