Skip to main content

Performance

Time Wheel Benchmarks

Apple M4 / arm64. Pure scheduling engine, no Redis.

TestResult
1M Add225ms (4.4M tasks/sec, 225 ns/op)
1M Add + Fire1.2s (all fired, zero loss)
4 writers x 250K187ms (5.3M tasks/sec)
1M Cancel268ms (290 ns/op)

vs Redis Sorted Set

Operationseqdelay (time wheel)Redis ZRANGEBYSCORE
Add225 ns (local memory)~0.5 ms (network RTT)
Fire checkO(1) per tickO(log N) per poll
Precision1ms configurable~1s (poll interval)
Redis loadOn state change onlyEvery poll cycle

Running Benchmarks

# Time wheel only (no Redis needed)
go test -bench=BenchmarkTimeWheel -benchmem -count=1

# Stress test: 1M tasks
go test -run TestStress -v -timeout 120s

# Full lifecycle (needs Redis)
go test -bench=BenchmarkQueue -benchmem -timeout 60s

# All benchmarks
go test -bench=. -benchmem -count=1 -timeout 120s