RussellLuo / timingwheel

Golang implementation of Hierarchical Timing Wheels.
MIT License
660 stars 125 forks source link

时间轮是不是在go的版本1.14之后与timer对比就没有优势了? #37

Open luozhiyun993 opened 3 years ago

luozhiyun993 commented 3 years ago

时间轮是不是在go的版本1.14之后与timer对比就没有优势了?

附上benchmark:

goos: darwin
goarch: amd64
pkg: gin-test/api/main
BenchmarkTimingWheel_StartStop/N-1m-12   4582120               254 ns/op              85 B/op          2 allocs/op
BenchmarkTimingWheel_StartStop/N-5m-12   3356630               427 ns/op              46 B/op          1 allocs/op
BenchmarkTimingWheel_StartStop/N-10m-12                  2474842               483 ns/op              60 B/op          1 allocs/op
BenchmarkStandardTimer_StartStop/N-1m-12                 6777975               179 ns/op              84 B/op          1 allocs/op
BenchmarkStandardTimer_StartStop/N-5m-12                 6431217               231 ns/op              85 B/op          1 allocs/op
BenchmarkStandardTimer_StartStop/N-10m-12                5374492               266 ns/op              83 B/op          1 allocs/op
PASS
ok      gin-test/api/main       60.414s