mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-24 05:25:19 +00:00
refactor(structure): move benchmarks, scenarios, adapters, utils to dedicated folders; update imports/project layout
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import 'package:benchmark_harness/benchmark_harness.dart';
|
||||
import 'package:benchmark_cherrypick/di_adapters/di_adapter.dart';
|
||||
import 'package:benchmark_cherrypick/scenarios/chain_factory_module.dart';
|
||||
import 'package:benchmark_cherrypick/scenarios/service.dart';
|
||||
|
||||
class ChainFactoryBenchmark extends BenchmarkBase {
|
||||
final DIAdapter di;
|
||||
final int chainCount;
|
||||
final int nestingDepth;
|
||||
|
||||
ChainFactoryBenchmark(
|
||||
this.di, {
|
||||
this.chainCount = 1,
|
||||
this.nestingDepth = 3,
|
||||
}) : super(
|
||||
'ChainFactory (A->B->C, factory). '
|
||||
'C/D = $chainCount/$nestingDepth. ',
|
||||
);
|
||||
|
||||
@override
|
||||
void setup() {
|
||||
di.setupModules([
|
||||
ChainFactoryModule(
|
||||
chainCount: chainCount,
|
||||
nestingDepth: nestingDepth,
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
@override
|
||||
void teardown() => di.teardown();
|
||||
|
||||
@override
|
||||
void run() {
|
||||
final serviceName = '${chainCount.toString()}_${nestingDepth.toString()}';
|
||||
di.resolve<Service>(named: serviceName);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user