refactor: full generic DIAdapter workflow & universalRegistration abstraction

- Made UniversalChainBenchmark and UniversalChainAsyncBenchmark fully generic with strong typing for DIAdapter<TContainer>
- Moved all universalRegistration logic inside adapters; removed global function and typedef
- Replaced dynamic/object-based registration with type-safe generic contracts end-to-end
- Updated CLI and usage: all DI and scenarios are invoked via type-safe generics
- Fixed all analysis errors, Riverpod async/future usages, and imports for full Dart 3 compatibility
- All benchmarks fully pass for Cherrypick, GetIt, and Riverpod adapters
This commit is contained in:
Sergey Penkovsky
2025-08-07 14:11:29 +03:00
parent 54446868e4
commit 56bdb3946e
8 changed files with 223 additions and 204 deletions

View File

@@ -2,10 +2,9 @@ import 'package:benchmark_harness/benchmark_harness.dart';
import 'package:benchmark_di/di_adapters/di_adapter.dart';
import 'package:benchmark_di/scenarios/universal_chain_module.dart';
import 'package:benchmark_di/scenarios/universal_service.dart';
import 'package:benchmark_di/scenarios/di_universal_registration.dart';
class UniversalChainAsyncBenchmark extends AsyncBenchmarkBase {
final DIAdapter di;
class UniversalChainAsyncBenchmark<TContainer> extends AsyncBenchmarkBase {
final DIAdapter<TContainer> di;
final int chainCount;
final int nestingDepth;
final UniversalBindingMode mode;
@@ -19,8 +18,7 @@ class UniversalChainAsyncBenchmark extends AsyncBenchmarkBase {
@override
Future<void> setup() async {
di.setupDependencies(getUniversalRegistration(
di,
di.setupDependencies(di.universalRegistration(
chainCount: chainCount,
nestingDepth: nestingDepth,
bindingMode: mode,