Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
systay committed Jan 17, 2025
1 parent b75398d commit 700bec3
Show file tree
Hide file tree
Showing 9 changed files with 936 additions and 0 deletions.
Binary file added cpu.prof
Binary file not shown.
38 changes: 38 additions & 0 deletions go/vt/vtgate/planbuilder/plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -872,3 +872,41 @@ func benchmarkPlanner(b *testing.B, version plancontext.PlannerVersion, testCase
}
}
}

func (s *planTestSuite) TestMy() {
vschema, err := vschemawrapper.NewVschemaWrapper(
vtenv.NewTestEnv(),
loadSchema(s.T(), "vschemas/my_schema.json", true),
TestBuilder,
)
require.NoError(s.T(), err)
// vschema := &vschemawrapper.VSchemaWrapper{
// V: loadSchema(s.T(), "vschemas/my_schema.json", true),
// SysVarEnabled: true,
// Version: Gen4,
// Env: vtenv.NewTestEnv(),
// }

s.testFile("my.json", vschema, false)
}

func BenchmarkMine(b *testing.B) {
vschema, err := vschemawrapper.NewVschemaWrapper(
vtenv.NewTestEnv(),
loadSchema(b, "vschemas/my_schema.json", true),
TestBuilder,
)
require.NoError(b, err)
testCases := readJSONTests("my.json")

b.ReportAllocs()
b.ResetTimer()
for range b.N {
for _, tcase := range testCases {
plan, _ := TestBuilder(tcase.Query, vschema, vschema.CurrentDb())
if plan == nil {
panic("")
}
}
}
}
740 changes: 740 additions & 0 deletions go/vt/vtgate/planbuilder/testdata/my.json

Large diffs are not rendered by default.

110 changes: 110 additions & 0 deletions go/vt/vtgate/planbuilder/testdata/vschemas/my_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"keyspaces": {
"unsharded_ns": {
"sharded": false,
"tables": {
"my_table_seq": {
"type": "sequence",
"columns": [
{
"name": "next_id",
"type": "UINT64"
},
{
"name": "cache",
"type": "UINT32"
},
{
"name": "id",
"type": "UINT64"
}
],
"column_list_authoritative": true
}
}
},
"main": {
"sharded": true,
"vindexes": {
"binary_vdx": {
"type": "binary"
}
},
"tables": {
"my_table": {
"column_vindexes": [
{
"columns": [
"sdKey"
],
"name": "binary_vdx"
}
],
"auto_increment": {
"column": "id",
"sequence": "my_table_seq"
},
"columns": [
{
"name": "col01",
"type": "VARCHAR"
},
{
"name": "col02",
"type": "INT64"
},
{
"name": "col03",
"type": "BLOB"
},
{
"name": "col04",
"type": "VARCHAR"
},
{
"name": "col05",
"type": "VARBINARY"
},
{
"name": "col06",
"type": "INT8"
},
{
"name": "col07",
"type": "INT64"
},
{
"name": "col08",
"type": "VARBINARY"
},
{
"name": "sdKey",
"type": "VARBINARY"
},
{
"name": "col09",
"type": "INT64"
},
{
"name": "col10",
"type": "INT64"
},
{
"name": "col11",
"type": "INT64"
},
{
"name": "col12",
"type": "INT64"
},
{
"name": "id",
"type": "UINT64"
}
],
"column_list_authoritative": true
}
}
}
}
}
Binary file added memprofile.out
Binary file not shown.
16 changes: 16 additions & 0 deletions new.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
goos: darwin
goarch: arm64
pkg: vitess.io/vitess/go/vt/vtgate/planbuilder
cpu: Apple M1 Pro
BenchmarkMine-10 226 5414522 ns/op 3534348 B/op 71107 allocs/op
BenchmarkMine-10 242 4954859 ns/op 3534127 B/op 71106 allocs/op
BenchmarkMine-10 240 4980136 ns/op 3533776 B/op 71105 allocs/op
BenchmarkMine-10 235 5310915 ns/op 3533834 B/op 71106 allocs/op
BenchmarkMine-10 241 5086943 ns/op 3534022 B/op 71107 allocs/op
BenchmarkMine-10 242 4990665 ns/op 3533751 B/op 71106 allocs/op
BenchmarkMine-10 241 5004904 ns/op 3534083 B/op 71107 allocs/op
BenchmarkMine-10 242 5009568 ns/op 3534540 B/op 71108 allocs/op
BenchmarkMine-10 235 5024306 ns/op 3534362 B/op 71108 allocs/op
BenchmarkMine-10 237 5163583 ns/op 3534147 B/op 71107 allocs/op
PASS
ok vitess.io/vitess/go/vt/vtgate/planbuilder 19.387s
16 changes: 16 additions & 0 deletions old.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
goos: darwin
goarch: arm64
pkg: vitess.io/vitess/go/vt/vtgate/planbuilder
cpu: Apple M1 Pro
BenchmarkMine-10 206 5468655 ns/op 3683900 B/op 74513 allocs/op
BenchmarkMine-10 216 5452287 ns/op 3683589 B/op 74511 allocs/op
BenchmarkMine-10 214 5510678 ns/op 3684216 B/op 74512 allocs/op
BenchmarkMine-10 218 5426798 ns/op 3684354 B/op 74513 allocs/op
BenchmarkMine-10 222 5427010 ns/op 3684368 B/op 74512 allocs/op
BenchmarkMine-10 219 5461373 ns/op 3684293 B/op 74513 allocs/op
BenchmarkMine-10 218 5544313 ns/op 3683700 B/op 74511 allocs/op
BenchmarkMine-10 219 5446030 ns/op 3684065 B/op 74512 allocs/op
BenchmarkMine-10 218 5513812 ns/op 3683917 B/op 74512 allocs/op
BenchmarkMine-10 218 5471942 ns/op 3684090 B/op 74513 allocs/op
PASS
ok vitess.io/vitess/go/vt/vtgate/planbuilder 18.180s
Binary file added planbuilder.test
Binary file not shown.
16 changes: 16 additions & 0 deletions with_cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
goos: darwin
goarch: arm64
pkg: vitess.io/vitess/go/vt/vtgate/planbuilder
cpu: Apple M1 Ultra
BenchmarkMine-20 202 5858150 ns/op 3687144 B/op 74512 allocs/op
BenchmarkMine-20 205 5884388 ns/op 3687345 B/op 74512 allocs/op
BenchmarkMine-20 205 5872149 ns/op 3687565 B/op 74513 allocs/op
BenchmarkMine-20 206 5813034 ns/op 3687350 B/op 74512 allocs/op
BenchmarkMine-20 207 5836727 ns/op 3687054 B/op 74512 allocs/op
BenchmarkMine-20 207 5826613 ns/op 3687322 B/op 74512 allocs/op
BenchmarkMine-20 204 5839730 ns/op 3687249 B/op 74512 allocs/op
BenchmarkMine-20 205 5814595 ns/op 3687180 B/op 74511 allocs/op
BenchmarkMine-20 205 5796803 ns/op 3687704 B/op 74513 allocs/op
BenchmarkMine-20 207 5861450 ns/op 3687561 B/op 74513 allocs/op
PASS
ok vitess.io/vitess/go/vt/vtgate/planbuilder 19.160s

0 comments on commit 700bec3

Please sign in to comment.