mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-01-23 21:13:35 +00:00
docs: update EN/RU quick start and tutorial with Fast Map-based lookup section; clarify performance benefit in README
This commit is contained in:
@@ -94,6 +94,13 @@ final subScope = rootScope.openSubScope('featureScope')
|
||||
final dataBloc = await subScope.resolveAsync<DataBloc>();
|
||||
```
|
||||
|
||||
### Fast Dependency Lookup (Performance Improvement)
|
||||
|
||||
> **Performance Note:**
|
||||
> As of the latest version, CherryPick uses a Map-based resolver index for dependency lookup. This means calls to `resolve<T>()` and related methods are now O(1) operations, regardless of the number of modules or bindings in your scope. Previously, the library had to iterate over all modules and bindings to locate the requested dependency, which could impact performance as your project grew.
|
||||
>
|
||||
> This optimization is internal and does not change any library APIs or usage patterns, but it significantly improves resolution speed in larger applications.
|
||||
|
||||
### Dependency Lookup API
|
||||
|
||||
- `resolve<T>()` — Locates a dependency instance or throws if missing.
|
||||
|
||||
@@ -177,6 +177,14 @@ final service = scope.tryResolve<OptionalService>(); // returns null if not exis
|
||||
|
||||
---
|
||||
|
||||
### Fast Dependency Lookup (Performance Improvement)
|
||||
|
||||
> **Performance Note:**
|
||||
> As of the latest version, CherryPick uses a Map-based resolver index for dependency lookup. This means calls to `resolve<T>()`, `tryResolve<T>()` and similar methods are now O(1) operations, regardless of the number of modules or bindings within your scope. Previously it would iterate over all modules and bindings, which could reduce performance as your project grew. This optimization is internal and does not affect the public API or usage patterns, but significantly improves resolution speed for larger applications.
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Dependency injection with annotations & code generation
|
||||
|
||||
CherryPick supports DI with annotations, letting you eliminate manual DI setup.
|
||||
|
||||
@@ -178,6 +178,13 @@ final service = scope.tryResolve<OptionalService>(); // вернет null, ес
|
||||
|
||||
---
|
||||
|
||||
### Быстрый поиск зависимостей (Performance Improvement)
|
||||
|
||||
> **Примечание по производительности:**
|
||||
> В последних версиях CherryPick для поиска зависимости внутри scope используется Map-индекс. Благодаря этому методы `resolve<T>()`, `tryResolve<T>()` и аналогичные теперь работают за O(1), независимо от количества модулей и биндингов в вашем проекте. Ранее для поиска приходилось перебирать весь список вручную, что могло замедлять работу крупных приложений. Это внутреннее улучшение не меняет внешнего API или паттернов использования, но заметно ускоряет разрешение зависимостей на больших проектах.
|
||||
|
||||
---
|
||||
|
||||
## Внедрение зависимостей через аннотации и автогенерацию
|
||||
|
||||
CherryPick поддерживает DI через аннотации, что позволяет полностью избавиться от ручного внедрения зависимостей.
|
||||
|
||||
Reference in New Issue
Block a user