Skip to content

Commit a66a60d

Browse files
committed
wip
1 parent b16f792 commit a66a60d

File tree

9 files changed

+936
-0
lines changed

9 files changed

+936
-0
lines changed

cpu.prof

60.4 KB
Binary file not shown.

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+
}

go/vt/vtgate/planbuilder/testdata/my.json

+740
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"keyspaces": {
3+
"unsharded_ns": {
4+
"sharded": false,
5+
"tables": {
6+
"my_table_seq": {
7+
"type": "sequence",
8+
"columns": [
9+
{
10+
"name": "next_id",
11+
"type": "UINT64"
12+
},
13+
{
14+
"name": "cache",
15+
"type": "UINT32"
16+
},
17+
{
18+
"name": "id",
19+
"type": "UINT64"
20+
}
21+
],
22+
"column_list_authoritative": true
23+
}
24+
}
25+
},
26+
"main": {
27+
"sharded": true,
28+
"vindexes": {
29+
"binary_vdx": {
30+
"type": "binary"
31+
}
32+
},
33+
"tables": {
34+
"my_table": {
35+
"column_vindexes": [
36+
{
37+
"columns": [
38+
"sdKey"
39+
],
40+
"name": "binary_vdx"
41+
}
42+
],
43+
"auto_increment": {
44+
"column": "id",
45+
"sequence": "my_table_seq"
46+
},
47+
"columns": [
48+
{
49+
"name": "col01",
50+
"type": "VARCHAR"
51+
},
52+
{
53+
"name": "col02",
54+
"type": "INT64"
55+
},
56+
{
57+
"name": "col03",
58+
"type": "BLOB"
59+
},
60+
{
61+
"name": "col04",
62+
"type": "VARCHAR"
63+
},
64+
{
65+
"name": "col05",
66+
"type": "VARBINARY"
67+
},
68+
{
69+
"name": "col06",
70+
"type": "INT8"
71+
},
72+
{
73+
"name": "col07",
74+
"type": "INT64"
75+
},
76+
{
77+
"name": "col08",
78+
"type": "VARBINARY"
79+
},
80+
{
81+
"name": "sdKey",
82+
"type": "VARBINARY"
83+
},
84+
{
85+
"name": "col09",
86+
"type": "INT64"
87+
},
88+
{
89+
"name": "col10",
90+
"type": "INT64"
91+
},
92+
{
93+
"name": "col11",
94+
"type": "INT64"
95+
},
96+
{
97+
"name": "col12",
98+
"type": "INT64"
99+
},
100+
{
101+
"name": "id",
102+
"type": "UINT64"
103+
}
104+
],
105+
"column_list_authoritative": true
106+
}
107+
}
108+
}
109+
}
110+
}

memprofile.out

202 KB
Binary file not shown.

new.txt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
goos: darwin
2+
goarch: arm64
3+
pkg: vitess.io/vitess/go/vt/vtgate/planbuilder
4+
cpu: Apple M1 Pro
5+
BenchmarkMine-10 226 5414522 ns/op 3534348 B/op 71107 allocs/op
6+
BenchmarkMine-10 242 4954859 ns/op 3534127 B/op 71106 allocs/op
7+
BenchmarkMine-10 240 4980136 ns/op 3533776 B/op 71105 allocs/op
8+
BenchmarkMine-10 235 5310915 ns/op 3533834 B/op 71106 allocs/op
9+
BenchmarkMine-10 241 5086943 ns/op 3534022 B/op 71107 allocs/op
10+
BenchmarkMine-10 242 4990665 ns/op 3533751 B/op 71106 allocs/op
11+
BenchmarkMine-10 241 5004904 ns/op 3534083 B/op 71107 allocs/op
12+
BenchmarkMine-10 242 5009568 ns/op 3534540 B/op 71108 allocs/op
13+
BenchmarkMine-10 235 5024306 ns/op 3534362 B/op 71108 allocs/op
14+
BenchmarkMine-10 237 5163583 ns/op 3534147 B/op 71107 allocs/op
15+
PASS
16+
ok vitess.io/vitess/go/vt/vtgate/planbuilder 19.387s

old.txt

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
goos: darwin
2+
goarch: arm64
3+
pkg: vitess.io/vitess/go/vt/vtgate/planbuilder
4+
cpu: Apple M1 Pro
5+
BenchmarkMine-10 206 5468655 ns/op 3683900 B/op 74513 allocs/op
6+
BenchmarkMine-10 216 5452287 ns/op 3683589 B/op 74511 allocs/op
7+
BenchmarkMine-10 214 5510678 ns/op 3684216 B/op 74512 allocs/op
8+
BenchmarkMine-10 218 5426798 ns/op 3684354 B/op 74513 allocs/op
9+
BenchmarkMine-10 222 5427010 ns/op 3684368 B/op 74512 allocs/op
10+
BenchmarkMine-10 219 5461373 ns/op 3684293 B/op 74513 allocs/op
11+
BenchmarkMine-10 218 5544313 ns/op 3683700 B/op 74511 allocs/op
12+
BenchmarkMine-10 219 5446030 ns/op 3684065 B/op 74512 allocs/op
13+
BenchmarkMine-10 218 5513812 ns/op 3683917 B/op 74512 allocs/op
14+
BenchmarkMine-10 218 5471942 ns/op 3684090 B/op 74513 allocs/op
15+
PASS
16+
ok vitess.io/vitess/go/vt/vtgate/planbuilder 18.180s

planbuilder.test

66.7 MB
Binary file not shown.

with_cache

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
goos: darwin
2+
goarch: arm64
3+
pkg: vitess.io/vitess/go/vt/vtgate/planbuilder
4+
cpu: Apple M1 Ultra
5+
BenchmarkMine-20 202 5858150 ns/op 3687144 B/op 74512 allocs/op
6+
BenchmarkMine-20 205 5884388 ns/op 3687345 B/op 74512 allocs/op
7+
BenchmarkMine-20 205 5872149 ns/op 3687565 B/op 74513 allocs/op
8+
BenchmarkMine-20 206 5813034 ns/op 3687350 B/op 74512 allocs/op
9+
BenchmarkMine-20 207 5836727 ns/op 3687054 B/op 74512 allocs/op
10+
BenchmarkMine-20 207 5826613 ns/op 3687322 B/op 74512 allocs/op
11+
BenchmarkMine-20 204 5839730 ns/op 3687249 B/op 74512 allocs/op
12+
BenchmarkMine-20 205 5814595 ns/op 3687180 B/op 74511 allocs/op
13+
BenchmarkMine-20 205 5796803 ns/op 3687704 B/op 74513 allocs/op
14+
BenchmarkMine-20 207 5861450 ns/op 3687561 B/op 74513 allocs/op
15+
PASS
16+
ok vitess.io/vitess/go/vt/vtgate/planbuilder 19.160s

0 commit comments

Comments
 (0)