mirror of
https://github.com/octoleo/restic.git
synced 2024-11-25 22:27:35 +00:00
index: add garbage collection benchmark
Allocates an index and repeatedly triggers the GC.
This commit is contained in:
parent
ffca602315
commit
0c1240360d
@ -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 New Issue
Block a user