Skip to content

Commit 833b859

Browse files
committed
add benchmark
Signed-off-by: Andres Taylor <[email protected]>
1 parent 76b1b01 commit 833b859

File tree

3 files changed

+888
-0
lines changed

3 files changed

+888
-0
lines changed

go/vt/vtgate/planbuilder/plan_test.go

+38
Original file line numberDiff line numberDiff line change
@@ -872,3 +872,41 @@ func benchmarkPlanner(b *testing.B, version plancontext.PlannerVersion, testCase
872872
}
873873
}
874874
}
875+
876+
func (s *planTestSuite) TestMy() {
877+
vschema, err := vschemawrapper.NewVschemaWrapper(
878+
vtenv.NewTestEnv(),
879+
loadSchema(s.T(), "vschemas/my_schema.json", true),
880+
TestBuilder,
881+
)
882+
require.NoError(s.T(), err)
883+
// vschema := &vschemawrapper.VSchemaWrapper{
884+
// V: loadSchema(s.T(), "vschemas/my_schema.json", true),
885+
// SysVarEnabled: true,
886+
// Version: Gen4,
887+
// Env: vtenv.NewTestEnv(),
888+
// }
889+
890+
s.testFile("my.json", vschema, false)
891+
}
892+
893+
func BenchmarkMine(b *testing.B) {
894+
vschema, err := vschemawrapper.NewVschemaWrapper(
895+
vtenv.NewTestEnv(),
896+
loadSchema(b, "vschemas/my_schema.json", true),
897+
TestBuilder,
898+
)
899+
require.NoError(b, err)
900+
testCases := readJSONTests("my.json")
901+
902+
b.ReportAllocs()
903+
b.ResetTimer()
904+
for range b.N {
905+
for _, tcase := range testCases {
906+
plan, _ := TestBuilder(tcase.Query, vschema, vschema.CurrentDb())
907+
if plan == nil {
908+
panic("")
909+
}
910+
}
911+
}
912+
}

0 commit comments

Comments
 (0)