mirror of
https://github.com/restic/restic.git
synced 2025-03-13 19:41:10 +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"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"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 (
|
var (
|
||||||
snapshotTime = time.Unix(1470492820, 207401672)
|
snapshotTime = time.Unix(1470492820, 207401672)
|
||||||
depth = 3
|
depth = 3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user