Add batch writes cases to sqlite storage benchmarks

This commit is contained in:
Matt Joiner 2021-02-03 18:55:14 +11:00
parent f3cd7007eb
commit 6f9c2fed61
1 changed files with 21 additions and 17 deletions

View File

@ -72,6 +72,8 @@ func BenchmarkMarkComplete(b *testing.B) {
c := qt.New(b)
for _, memory := range []bool{false, true} {
b.Run(fmt.Sprintf("Memory=%v", memory), func(b *testing.B) {
for _, batchWrites := range []bool{false, true} {
b.Run(fmt.Sprintf("BatchWrites=%v", batchWrites), func(b *testing.B) {
dbPath := filepath.Join(b.TempDir(), "storage.db")
//b.Logf("storage db path: %q", dbPath)
ci, err := NewPiecesStorage(NewPiecesStorageOpts{
@ -83,7 +85,7 @@ func BenchmarkMarkComplete(b *testing.B) {
Memory: memory,
},
ProvOpts: func(opts *ProviderOpts) {
opts.BatchWrites = true
opts.BatchWrites = batchWrites
},
})
c.Assert(err, qt.IsNil)
@ -91,4 +93,6 @@ func BenchmarkMarkComplete(b *testing.B) {
test_storage.BenchmarkPieceMarkComplete(b, ci, pieceSize, 16, capacity)
})
}
})
}
}