Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
89661: sql: fix BenchmarkGetZoneConfig r=ajwerner a=ajwerner

Some of the test setup was in the loop and all of the cost was in that setup. After this change, the benchmark takes 90ns and no allocations.

Fixes cockroachdb#89410

Release note: None

Co-authored-by: Andrew Werner <[email protected]>
  • Loading branch information
craig[bot] and ajwerner committed Oct 10, 2022
2 parents 94e2a2b + a106721 commit 23a26a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/sql/zone_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,9 +657,9 @@ func BenchmarkGetZoneConfig(b *testing.B) {
s := srv.(*server.TestServer)
cfg := forceNewConfig(b, s)

key := roachpb.RKey(keys.SystemSQLCodec.TablePrefix(bootstrap.TestingUserDescID(0)))
b.ResetTimer()
for i := 0; i < b.N; i++ {
key := roachpb.RKey(keys.SystemSQLCodec.TablePrefix(bootstrap.TestingUserDescID(0)))
_, _, err := config.TestingGetSystemTenantZoneConfigForKey(cfg, key)
if err != nil {
b.Fatal(err)
Expand Down

0 comments on commit 23a26a3

Please sign in to comment.