Skip to content

Commit

Permalink
colexec: remove BenchmarkLogicalProjOp as having too high variance
Browse files Browse the repository at this point in the history
Even after making the seed constant, this benchmark has too high of
a variance, so it doesn't seem that useful (actually seems to have
negative value since it can show up as a huge regression on unrelated
changes like this [one](https://gist.github.com/yuzefovich/0834cf0477abbd9b9ba0189970d15338)
which only modified `colexechash` and `colexecjoin` packages).

Epic: None

Release note: None
  • Loading branch information
yuzefovich committed Apr 28, 2023
1 parent c5fb09d commit 263bedf
Showing 1 changed file with 0 additions and 72 deletions.
72 changes: 0 additions & 72 deletions pkg/sql/colexec/and_or_projection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"fmt"
"testing"

"github.com/cockroachdb/cockroach/pkg/col/coldata"
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
"github.com/cockroachdb/cockroach/pkg/sql/colexec/colexecbase"
"github.com/cockroachdb/cockroach/pkg/sql/colexec/colexectestutils"
Expand All @@ -25,8 +24,6 @@ import (
"github.com/cockroachdb/cockroach/pkg/sql/types"
"github.com/cockroachdb/cockroach/pkg/util/leaktest"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/cockroach/pkg/util/randutil"
"github.com/stretchr/testify/require"
)

type andOrTestCase struct {
Expand Down Expand Up @@ -219,72 +216,3 @@ func TestAndOrOps(t *testing.T) {
})
}
}

func benchmarkLogicalProjOp(
b *testing.B, operation string, useSelectionVector bool, hasNulls bool,
) {
ctx := context.Background()
st := cluster.MakeTestingClusterSettings()
evalCtx := eval.MakeTestingEvalContext(st)
defer evalCtx.Stop(ctx)
flowCtx := &execinfra.FlowCtx{
EvalCtx: &evalCtx,
Mon: evalCtx.TestingMon,
Cfg: &execinfra.ServerConfig{
Settings: st,
},
}
rng := randutil.NewTestRandWithSeed(91)

batch := testAllocator.NewMemBatchWithMaxCapacity([]*types.T{types.Bool, types.Bool})
col1 := batch.ColVec(0).Bool()
col2 := batch.ColVec(0).Bool()
for i := 0; i < coldata.BatchSize(); i++ {
col1[i] = rng.Float64() < 0.5
col2[i] = rng.Float64() < 0.5
}
if hasNulls {
nulls1 := batch.ColVec(0).Nulls()
nulls2 := batch.ColVec(0).Nulls()
for i := 0; i < coldata.BatchSize(); i++ {
if rng.Float64() < 0.1 {
nulls1.SetNull(i)
}
if rng.Float64() < 0.1 {
nulls2.SetNull(i)
}
}
}
batch.SetLength(coldata.BatchSize())
if useSelectionVector {
batch.SetSelection(true)
sel := batch.Selection()
for i := 0; i < coldata.BatchSize(); i++ {
sel[i] = i
}
}
typs := []*types.T{types.Bool, types.Bool}
input := colexecop.NewRepeatableBatchSource(testAllocator, batch, typs)
logicalProjOp, err := colexectestutils.CreateTestProjectingOperator(
ctx, flowCtx, input, typs, fmt.Sprintf("@1 %s @2", operation), testMemAcc,
)
require.NoError(b, err)
logicalProjOp.Init(ctx)

b.SetBytes(int64(8 * coldata.BatchSize()))
for i := 0; i < b.N; i++ {
logicalProjOp.Next()
}
}

func BenchmarkLogicalProjOp(b *testing.B) {
for _, operation := range []string{"AND", "OR"} {
for _, useSel := range []bool{true, false} {
for _, hasNulls := range []bool{true, false} {
b.Run(fmt.Sprintf("%s,useSel=%t,hasNulls=%t", operation, useSel, hasNulls), func(b *testing.B) {
benchmarkLogicalProjOp(b, operation, useSel, hasNulls)
})
}
}
}
}

0 comments on commit 263bedf

Please sign in to comment.