mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/mergeset: fix data race in BenchmarkInmemoryBlockMarshal
This commit is contained in:
parent
30e968df6d
commit
7030429958
1 changed files with 9 additions and 8 deletions
|
@ -50,6 +50,11 @@ func BenchmarkInmemoryBlockMarshal(b *testing.B) {
|
||||||
|
|
||||||
func benchmarkInmemoryBlockMarshal(b *testing.B, prefix string) {
|
func benchmarkInmemoryBlockMarshal(b *testing.B, prefix string) {
|
||||||
const itemsCount = 500
|
const itemsCount = 500
|
||||||
|
|
||||||
|
b.ResetTimer()
|
||||||
|
b.SetBytes(int64(itemsCount * len(prefix)))
|
||||||
|
b.ReportAllocs()
|
||||||
|
b.RunParallel(func(pb *testing.PB) {
|
||||||
var ibSrc inmemoryBlock
|
var ibSrc inmemoryBlock
|
||||||
for i := 0; i < itemsCount; i++ {
|
for i := 0; i < itemsCount; i++ {
|
||||||
item := []byte(fmt.Sprintf("%s%d", prefix, i))
|
item := []byte(fmt.Sprintf("%s%d", prefix, i))
|
||||||
|
@ -59,10 +64,6 @@ func benchmarkInmemoryBlockMarshal(b *testing.B, prefix string) {
|
||||||
}
|
}
|
||||||
sort.Sort(&ibSrc)
|
sort.Sort(&ibSrc)
|
||||||
|
|
||||||
b.ResetTimer()
|
|
||||||
b.SetBytes(int64(itemsCount * len(prefix)))
|
|
||||||
b.ReportAllocs()
|
|
||||||
b.RunParallel(func(pb *testing.PB) {
|
|
||||||
var sb storageBlock
|
var sb storageBlock
|
||||||
var firstItem, commonPrefix []byte
|
var firstItem, commonPrefix []byte
|
||||||
var n uint32
|
var n uint32
|
||||||
|
|
Loading…
Reference in a new issue