v0.11.0: Improve performance of in-memory rate-limit counter
- Improves throughput by 2.6x π
- Reduces memory footprint and allocations by 2x π
$ benchstat old.txt new.txt
goos: darwin
goarch: arm64
pkg: github.com/go-chi/httprate
β old.txt β new.txt β
β sec/op β sec/op vs base β
LocalCounter-8 34.65m Β± 3% 13.50m Β± 2% -61.04% (p=0.000 n=10)
β old.txt β new.txt β
β B/op β B/op vs base β
LocalCounter-8 4.384Mi Β± 0% 2.846Mi Β± 0% -35.07% (p=0.000 n=10)
β old.txt β new.txt β
β allocs/op β allocs/op vs base β
LocalCounter-8 253.9k Β± 0% 121.6k Β± 0% -52.12% (p=0.000 n=10)