storage/sqlite/sqlite-storage_test.go | 38 +++++++++++++++++++++----------------- diff --git a/storage/sqlite/sqlite-storage_test.go b/storage/sqlite/sqlite-storage_test.go index 65b63205e67f3bd6fbd4cf1a0e3f393860f26257..3f599d5169278051b8da00f591151ad3e18cb177 100644 --- a/storage/sqlite/sqlite-storage_test.go +++ b/storage/sqlite/sqlite-storage_test.go @@ -72,23 +72,27 @@ const capacity = 0 c := qt.New(b) for _, memory := range []bool{false, true} { b.Run(fmt.Sprintf("Memory=%v", memory), func(b *testing.B) { - dbPath := filepath.Join(b.TempDir(), "storage.db") - //b.Logf("storage db path: %q", dbPath) - ci, err := NewPiecesStorage(NewPiecesStorageOpts{ - NewPoolOpts: NewPoolOpts{ - Path: dbPath, - Capacity: 4*pieceSize - 1, - NoConcurrentBlobReads: false, - PageSize: 1 << 14, - Memory: memory, - }, - ProvOpts: func(opts *ProviderOpts) { - opts.BatchWrites = true - }, - }) - c.Assert(err, qt.IsNil) - defer ci.Close() - test_storage.BenchmarkPieceMarkComplete(b, ci, pieceSize, 16, capacity) + 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{ + NewPoolOpts: NewPoolOpts{ + Path: dbPath, + Capacity: 4*pieceSize - 1, + NoConcurrentBlobReads: false, + PageSize: 1 << 14, + Memory: memory, + }, + ProvOpts: func(opts *ProviderOpts) { + opts.BatchWrites = batchWrites + }, + }) + c.Assert(err, qt.IsNil) + defer ci.Close() + test_storage.BenchmarkPieceMarkComplete(b, ci, pieceSize, 16, capacity) + }) + } }) } }