共计 712 个字符,预计需要花费 2 分钟才能阅读完成。
起源是这个 PR:
https://github.com/Yiling-J/theine-go/pull/42
我想优化 Theine 的 Read 性能所以做了一些改进。在我自己的 bnechmark 环境下
goos: darwin
goarch: amd64
pkg: github.com/maypok86/benchmarks/throughput
cpu: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
以及阿里云 ECS(同样 Intel 架构)上性能是超过 Ristretto 的,但是在 maypok86 的环境下 (M1 Max) 却还是比 Ristretto 慢挺多。因此想收集一下更多的测试结果。希望有 M 系列芯片的 v 友能帮忙测试一下。
步骤:
- clone 这个 repo: https://github.com/maypok86/benchmarks
- 修改 go.mod, 把 Theine 换到 perf 分支
replace github.com/Yiling-J/theine-go => github.com/Yiling-J/theine-go perf
go mod tidy
- 切换到 throughput 目录
- 执行
go test -run='^$' -cpu=8 -bench . -timeout=0
如果确实比 Ristretto 慢的话希望能做个 cpuprofile 然后把结果文件发给我, 注意 profile 前修改 throughput/bench_test.go
文件,只保留 client.Theine
以及reads=100%,writes=0%
cpuprofile 方法
go test -run='^$' -cpu=8 -bench . -timeout=0 -cpuprofile cpu.out
正文完