MCPcopy Create free account
hub / github.com/egonelbre/exp / BenchmarkDatabase_FsyncOff_Parallel

Function BenchmarkDatabase_FsyncOff_Parallel

schema/database_test.go:49–69  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

47}
48
49func BenchmarkDatabase_FsyncOff_Parallel(b *testing.B) {
50 ctx := context.Background()
51 WithDocker(ctx, b, false, func(b *testing.B, db *pgx.Conn, connstr string) {
52 b.ResetTimer()
53 defer b.StopTimer()
54
55 for i := 0; i < b.N; i++ {
56 var g errgroup.Group
57 for k := 0; k < parallelCreate; k++ {
58 g.Go(func() error {
59 withDatabase(ctx, connstr, b, func(b *testing.B, db *pgx.Conn) {
60 _, _ = db.Exec(ctx, DatabaseSchema)
61 })
62 return nil
63 })
64 }
65 g.Wait()
66
67 }
68 })
69}
70
71func WithDatabase[TB testing.TB](ctx context.Context, tb TB, fn func(t TB, db *pgx.Conn)) {
72 if *pgaddr == "" {

Callers

nothing calls this directly

Calls 2

WithDockerFunction · 0.85
withDatabaseFunction · 0.85

Tested by

no test coverage detected