-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit 2356566
Optimization: statements reuse previous column name (#1711)
#1708 added `[]mysqlField` cache to stmt. It was used only for MariaDB cached metadata.
This commit allows MySQL to also benefit from the metadata cache. If the
column names are the same as the cached metadata, it reuses them instead
of allocating new strings.
goos: darwin
goarch: arm64
pkg: github.com/go-sql-driver/mysql
cpu: Apple M1 Pro
│ master.txt │ reuse.txt │
│ sec/op │ sec/op vs base │
ReceiveMetadata-8 1.273m ± 2% 1.269m ± 2% ~ (p=1.000 n=10)
│ master.txt │ reuse.txt │
│ B/op │ B/op vs base │
ReceiveMetadata-8 88.17Ki ± 0% 80.39Ki ± 0% -8.82% (p=0.000 n=10)
│ master.txt │ reuse.txt │
│ allocs/op │ allocs/op vs base │
ReceiveMetadata-8 1015.00 ± 0% 16.00 ± 0% -98.42% (p=0.000 n=10)1 parent 6e944e1 commit 2356566
File tree
5 files changed
+24
-12
lines changed5 files changed
+24
-12
lines changedLines changed: 2 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
490 | 490 |
| |
491 | 491 |
| |
492 | 492 |
| |
493 | - | ||
494 | - | ||
495 | - | ||
496 | 493 |
| |
497 | 494 |
| |
498 | 495 |
| |
499 | 496 |
| |
500 | 497 |
| |
498 | + | ||
499 | + | ||
501 | 500 |
| |
502 | 501 |
| |
503 | 502 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
231 | 231 |
| |
232 | 232 |
| |
233 | 233 |
| |
234 | - | ||
234 | + | ||
235 | 235 |
| |
236 | 236 |
| |
237 | 237 |
| |
| |||
448 | 448 |
| |
449 | 449 |
| |
450 | 450 |
| |
451 | - | ||
451 | + | ||
452 | 452 |
| |
453 | 453 |
| |
454 | 454 |
| |
|
Lines changed: 16 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
702 | 702 |
| |
703 | 703 |
| |
704 | 704 |
| |
705 | - | ||
705 | + | ||
706 | 706 |
| |
707 | + | ||
708 | + | ||
709 | + | ||
707 | 710 |
| |
708 | 711 |
| |
709 | 712 |
| |
| |||
731 | 734 |
| |
732 | 735 |
| |
733 | 736 |
| |
734 | - | ||
737 | + | ||
738 | + | ||
739 | + | ||
740 | + | ||
741 | + | ||
742 | + | ||
735 | 743 |
| |
736 | 744 |
| |
737 | 745 |
| |
| |||
752 | 760 |
| |
753 | 761 |
| |
754 | 762 |
| |
755 | - | ||
763 | + | ||
764 | + | ||
765 | + | ||
766 | + | ||
767 | + | ||
768 | + | ||
756 | 769 |
| |
757 | 770 |
| |
758 | 771 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
186 | 186 |
| |
187 | 187 |
| |
188 | 188 |
| |
189 | - | ||
189 | + | ||
190 | 190 |
| |
191 | 191 |
| |
192 | 192 |
| |
| |||
208 | 208 |
| |
209 | 209 |
| |
210 | 210 |
| |
211 | - | ||
211 | + | ||
212 | 212 |
| |
213 | 213 |
| |
214 | 214 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
74 | 74 |
| |
75 | 75 |
| |
76 | 76 |
| |
77 | - | ||
77 | + | ||
78 | 78 |
| |
79 | 79 |
| |
80 | 80 |
| |
| |||
125 | 125 |
| |
126 | 126 |
| |
127 | 127 |
| |
128 | - | ||
128 | + | ||
129 | 129 |
| |
130 | 130 |
| |
131 | 131 |
| |
|
0 commit comments