MCPcopy
hub / github.com/jackc/pgx / BenchmarkAcquireAndRelease

Function BenchmarkAcquireAndRelease

pgxpool/bench_test.go:13–25  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

11)
12
13func BenchmarkAcquireAndRelease(b *testing.B) {
14 pool, err := pgxpool.New(context.Background(), os.Getenv("PGX_TEST_DATABASE"))
15 require.NoError(b, err)
16 defer pool.Close()
17
18 for b.Loop() {
19 c, err := pool.Acquire(context.Background())
20 if err != nil {
21 b.Fatal(err)
22 }
23 c.Release()
24 }
25}
26
27func BenchmarkMinimalPreparedSelectBaseline(b *testing.B) {
28 config, err := pgxpool.ParseConfig(os.Getenv("PGX_TEST_DATABASE"))

Callers

nothing calls this directly

Calls 4

NewFunction · 0.92
AcquireMethod · 0.80
ReleaseMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected