Skip to content

Commit

Permalink
More benchmarks.
Browse files Browse the repository at this point in the history
  • Loading branch information
ncruces committed Jun 11, 2024
1 parent e7f8311 commit ef065b6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
34 changes: 32 additions & 2 deletions tests/parallel/parallel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ func Test_memdb(t *testing.T) {
iter = 5000
}

memdb.Delete("test.db")
memdb.Create("test.db", nil)
name := "file:/test.db?vfs=memdb"
testParallel(t, name, iter)
Expand Down Expand Up @@ -142,11 +141,42 @@ func TestChildProcess(t *testing.T) {
testParallel(t, name, 1000)
}

func Benchmark_parallel(b *testing.B) {
if !vfs.SupportsSharedMemory {
b.Skip("skipping without shared memory")
}

sqlite3.Initialize()
b.ResetTimer()

name := "file:" +
filepath.Join(b.TempDir(), "test.db") +
"?_pragma=busy_timeout(10000)" +
"&_pragma=journal_mode(truncate)" +
"&_pragma=synchronous(off)"
testParallel(b, name, b.N)
}

func Benchmark_wal(b *testing.B) {
if !vfs.SupportsSharedMemory {
b.Skip("skipping without shared memory")
}

sqlite3.Initialize()
b.ResetTimer()

name := "file:" +
filepath.Join(b.TempDir(), "test.db") +
"?_pragma=busy_timeout(10000)" +
"&_pragma=journal_mode(wal)" +
"&_pragma=synchronous(off)"
testParallel(b, name, b.N)
}

func Benchmark_memdb(b *testing.B) {
sqlite3.Initialize()
b.ResetTimer()

memdb.Delete("test.db")
memdb.Create("test.db", nil)
name := "file:/test.db?vfs=memdb"
testParallel(b, name, b.N)
Expand Down
4 changes: 2 additions & 2 deletions vfs/tests/mptest/mptest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func Test_multiwrite01(t *testing.T) {
}

func Test_config01_memory(t *testing.T) {
memdb.Delete("test.db")
memdb.Create("test.db", nil)
ctx := util.NewContext(newContext(t))
cfg := config(ctx).WithArgs("mptest", "/test.db", "config01.test",
"--vfs", "memdb")
Expand All @@ -193,7 +193,7 @@ func Test_multiwrite01_memory(t *testing.T) {
t.Skip("skipping in short mode")
}

memdb.Delete("test.db")
memdb.Create("test.db", nil)
ctx := util.NewContext(newContext(t))
cfg := config(ctx).WithArgs("mptest", "/test.db", "multiwrite01.test",
"--vfs", "memdb")
Expand Down

0 comments on commit ef065b6

Please sign in to comment.