index: add garbage collection benchmark
Allocates an index and repeatedly triggers the GC.
This commit is contained in:
parent
ffca602315
commit
0c1240360d
1 changed files with 12 additions and 0 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"runtime"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -323,6 +324,17 @@ func BenchmarkMasterIndexEach(b *testing.B) {
|
|||
}
|
||||
}
|
||||
|
||||
func BenchmarkMasterIndexGC(b *testing.B) {
|
||||
mIdx, _ := createRandomMasterIndex(b, rand.New(rand.NewSource(0)), 100, 10000)
|
||||
|
||||
b.ResetTimer()
|
||||
|
||||
for i := 0; i < b.N; i++ {
|
||||
runtime.GC()
|
||||
}
|
||||
runtime.KeepAlive(mIdx)
|
||||
}
|
||||
|
||||
var (
|
||||
snapshotTime = time.Unix(1470492820, 207401672)
|
||||
depth = 3
|
||||
|
|
Loading…
Reference in a new issue