Performance
Fast resolves for small explicit service graphs.
Injex 1.3.0 caches dependency plans and uses a fast path for common constructor-injection graphs: singleton infrastructure plus transient application services.
Benchmark shape
The benchmark repeatedly resolves this graph:
- singleton
Settingsinstance; - singleton
ApiClient(settings); - transient repository, email sender, and audit log;
- transient
RegisterUser(repository, email_sender, audit_log).
Local result
| Library | Median resolve time |
|---|---|
| manual wiring | 0.265 µs/op |
| Injex | 0.818 µs/op |
| Wireup, same scope | 0.879 µs/op |
| Wireup, scope per operation | 1.559 µs/op |
| dependency-injector | 1.727 µs/op |
| lagom | 9.794 µs/op |
| punq | 56.795 µs/op |
Benchmarks are synthetic and not a universal ranking. They show the approximate overhead of Injex in its target shape: small explicit graphs reused by APIs, workers, CLIs, and tests.
Reproduce
uv run --with punq --with lagom --with dependency-injector --with wireup \
python benchmarks/resolve_graph.py