实现新的计数器算法(将时间分片, 统计更加精准)

This commit is contained in:
刘祥超
2023-07-13 15:37:08 +08:00
parent db520858b3
commit 73024fe38c
13 changed files with 501 additions and 46 deletions

View File

@@ -213,7 +213,7 @@ func BenchmarkCache_Add_Parallel(b *testing.B) {
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
var j = atomic.AddInt64(&i, 1)
cache.Write(types.String(j), j, fasttime.Now().Unix()+i%1024)
cache.Write(types.String(j%1e6), j, fasttime.Now().Unix()+i%1024)
}
})
}