Golang implementation of Hierarchical Timing Wheels.
$ go get -u github.com/RussellLuo/timingwheel
timingwheel
is ported from Kafka's purgatory, which is designed based on Hierarchical Timing Wheels.
中文博客:层级时间轮的 Golang 实现。
For usage and examples see the Godoc.
$ go test -bench=. -benchmem
goos: darwin
goarch: amd64
pkg: github.com/RussellLuo/timingwheel
BenchmarkTimingWheel_StartStop/N-1m-8 5000000 329 ns/op 83 B/op 2 allocs/op
BenchmarkTimingWheel_StartStop/N-5m-8 5000000 363 ns/op 95 B/op 2 allocs/op
BenchmarkTimingWheel_StartStop/N-10m-8 5000000 440 ns/op 37 B/op 1 allocs/op
BenchmarkStandardTimer_StartStop/N-1m-8 10000000 199 ns/op 64 B/op 1 allocs/op
BenchmarkStandardTimer_StartStop/N-5m-8 2000000 644 ns/op 64 B/op 1 allocs/op
BenchmarkStandardTimer_StartStop/N-10m-8 500000 2434 ns/op 64 B/op 1 allocs/op
PASS
ok github.com/RussellLuo/timingwheel 116.977s