跳到主要内容

性能

测试结果

Apple M4 / darwin arm64 / Go 1.22+ / 全部零分配。

单写者

场景seqflowchannel提升
每次 1 槽位2.1 ns21 ns10x
每次 16 槽位0.14 ns22 ns/条160x

多写者(4 goroutine)

场景seqflowchannel提升
每次 1 槽位39 ns100 ns2.6x
每次 16 槽位2.3 ns103 ns/条45x

运行 Benchmark

go test -bench=. -benchmem -count=3 -timeout 120s