2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-24 11:55:28 +00:00

Improve BenchmarkIndexSave

This commit is contained in:
Alexander Neumann 2017-01-17 13:00:59 +01:00
parent c4f44c7bcb
commit dac18e3bf8

View File

@ -141,12 +141,26 @@ func BenchmarkIndexNew(b *testing.B) {
}
func BenchmarkIndexSave(b *testing.B) {
repo, cleanup := createFilledRepo(b, 3, 0)
repo, cleanup := repository.TestRepository(b)
defer cleanup()
idx, err := New(repo, nil)
test.OK(b, err)
for i := 0; i < 8000; i++ {
entries := make([]restic.Blob, 0, 200)
for j := 0; j < len(entries); j++ {
entries = append(entries, restic.Blob{
ID: restic.NewRandomID(),
Length: 1000,
Offset: 5,
Type: restic.DataBlob,
})
}
idx.AddPack(restic.NewRandomID(), 10000, entries)
}
b.ResetTimer()
for i := 0; i < b.N; i++ {