Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opt/bench: fix benchmark regression #138740

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions pkg/sql/opt/bench/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,7 @@ type harness struct {
prepMemo *memo.Memo
testCat *testcat.Catalog
optimizer xform.Optimizer
gf explain.PlanGistFactory
}

func newHarness(tb testing.TB, query benchQuery, schemas []string) *harness {
Expand Down Expand Up @@ -943,12 +944,11 @@ func (h *harness) runSimple(tb testing.TB, query benchQuery, phase Phase) {
tb.Fatalf("invalid phase %s for Simple", phase)
}

var gf explain.PlanGistFactory
gf.Init(exec.StubFactory{})
h.gf.Init(exec.StubFactory{})
root := execMemo.RootExpr()
eb := execbuilder.New(
context.Background(),
&gf,
&h.gf,
&h.optimizer,
execMemo,
nil, /* catalog */
Expand Down Expand Up @@ -1001,12 +1001,11 @@ func (h *harness) runPrepared(tb testing.TB, phase Phase) {
tb.Fatalf("invalid phase %s for Prepared", phase)
}

var gf explain.PlanGistFactory
gf.Init(exec.StubFactory{})
h.gf.Init(exec.StubFactory{})
root := execMemo.RootExpr()
eb := execbuilder.New(
context.Background(),
&gf,
&h.gf,
&h.optimizer,
execMemo,
nil, /* catalog */
Expand Down Expand Up @@ -1779,9 +1778,9 @@ func BenchmarkExecBuild(b *testing.B) {
execMemo := h.optimizer.Memo()
root := execMemo.RootExpr()

var gf explain.PlanGistFactory
b.Run(tc.query.name, func(b *testing.B) {
for i := 0; i < b.N; i++ {
var gf explain.PlanGistFactory
gf.Init(exec.StubFactory{})
eb := execbuilder.New(
context.Background(),
Expand Down
4 changes: 2 additions & 2 deletions pkg/util/base64/base64.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
package base64

import (
"bytes"
"encoding/base64"
"strings"
)

// Encoder is a streaming encoder for base64 strings. It must be initialized
Expand All @@ -21,7 +21,7 @@ import (
// handling has been removed for simplification.
type Encoder struct {
enc *base64.Encoding
sb strings.Builder
sb bytes.Buffer
buf [3]byte // buffered data waiting to be encoded
nbuf int8 // number of bytes in buf
out [1024]byte // output buffer
Expand Down
Loading