Real-time performance metrics from our continuous benchmarking pipeline. All benchmarks run on every commit to track performance over time.
| Benchmark | Current | Previous | Change | Trend |
|---|---|---|---|---|
{{ benchmark.name }}
@if (benchmark.range) {
{{ benchmark.range }}
}
|
{{ formatValue(benchmark.current, benchmark.unit) }} | {{ benchmark.previous !== null ? formatValue(benchmark.previous, benchmark.unit) : '—' }} | {{ getChangeIcon(benchmark.changePercent) }} {{ formatChange(benchmark.changePercent) }} | @if (benchmark.history.length >= 2) { } @else { — } |
We benchmarked dependency-injector against common DI patterns in Rust. All tests use the same service types and measure equivalent operations.
| Approach | Singleton Resolution | Container Creation | 4-Thread Concurrent | Notes |
|---|---|---|---|---|
Manual DI |
~8 ns | ~88 ns | N/A | Baseline, no runtime lookup |
HashMap + RwLock |
~21 ns | ~7.6 ns | ~93 µs | Reader contention under load |
DashMap (basic) |
~21 ns | ~670 ns | ~89 µs | Lock-free, good scaling |
dependency-injector |
~9 ns | ~80 ns | ~90 µs | ~1ns from manual DI! |
Resolution time remains constant regardless of registered services:
O(1) lookup thanks to ahash + DashMap + fast bit-mixing
Near-linear scaling as threads increase:
Lock-free reads + thread-local cache = high throughput
At ~9ns per resolution, dependency-injector is within 1ns of manual dependency injection while providing full runtime DI features.
DashMap + thread-local cache eliminates lock contention. ~90µs for 4 threads × 100 reads each.
Scope pooling, deep parent chains, derive macros, perfect hashing, JSON logging — all with near-zero overhead.