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

Function BenchmarkMinimalUnpreparedSelectWithStatementCacheModeDescribe

bench_test.go:58–79  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

56}
57
58func BenchmarkMinimalUnpreparedSelectWithStatementCacheModeDescribe(b *testing.B) {
59 config := mustParseConfig(b, os.Getenv("PGX_TEST_DATABASE"))
60 config.DefaultQueryExecMode = pgx.QueryExecModeCacheDescribe
61 config.StatementCacheCapacity = 0
62 config.DescriptionCacheCapacity = 32
63
64 conn := mustConnect(b, config)
65 defer closeConn(b, conn)
66
67 var n int64
68
69 for i := 0; b.Loop(); i++ {
70 err := conn.QueryRow(context.Background(), "select $1::int8", i).Scan(&n)
71 if err != nil {
72 b.Fatal(err)
73 }
74
75 if n != int64(i) {
76 b.Fatalf("expected %d, got %d", i, n)
77 }
78 }
79}
80
81func BenchmarkMinimalUnpreparedSelectWithStatementCacheModePrepare(b *testing.B) {
82 config := mustParseConfig(b, os.Getenv("PGX_TEST_DATABASE"))

Callers

nothing calls this directly

Calls 5

mustParseConfigFunction · 0.70
mustConnectFunction · 0.70
closeConnFunction · 0.70
ScanMethod · 0.65
QueryRowMethod · 0.65

Tested by

no test coverage detected