-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reduce allocations when binding string/time args #1293
Open
charlievieth
wants to merge
1
commit into
mattn:master
Choose a base branch
from
charlievieth:cev/bind-perf
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1ffb93a
to
ef81ed6
Compare
This is no longer true since that commit/pr are no longer needed to make the CI tests pass. |
ef81ed6
to
0fdd7c9
Compare
011926c
to
5959360
Compare
6db1eec
to
a7c0d28
Compare
This commit reduces the number of allocations required to bind args by eliminating string to byte slice conversions for string and time.Time types and by only checking for bind parameters if any of the driver.NamedValue args are named. It also changes bind to only reset the sqlite3 statement when necessary - previously the statement was always reset even on first use (this yields a 3-4% performance boost). goos: darwin goarch: arm64 pkg: github.com/mattn/go-sqlite3 cpu: Apple M4 Pro │ y1.txt │ y2.txt │ │ sec/op │ sec/op vs base │ Suite/BenchmarkQuery-14 2.080µ ± 3% 1.995µ ± 0% -4.13% (p=0.000 n=10) Suite/BenchmarkParams-14 2.282µ ± 1% 2.181µ ± 2% -4.43% (p=0.000 n=10) Suite/BenchmarkStmt-14 1.537µ ± 1% 1.489µ ± 1% -3.16% (p=0.000 n=10) geomean 1.939µ 1.864µ -3.91% │ y1.txt │ y2.txt │ │ B/op │ B/op vs base │ Suite/BenchmarkQuery-14 688.0 ± 0% 688.0 ± 0% ~ (p=1.000 n=10) ¹ Suite/BenchmarkParams-14 1104.0 ± 0% 1000.0 ± 0% -9.42% (p=0.000 n=10) Suite/BenchmarkStmt-14 920.0 ± 0% 816.0 ± 0% -11.30% (p=0.000 n=10) geomean 887.4 824.9 -7.04% ¹ all samples are equal │ y1.txt │ y2.txt │ │ allocs/op │ allocs/op vs base │ Suite/BenchmarkQuery-14 23.00 ± 0% 23.00 ± 0% ~ (p=1.000 n=10) ¹ Suite/BenchmarkParams-14 27.00 ± 0% 25.00 ± 0% -7.41% (p=0.000 n=10) Suite/BenchmarkStmt-14 25.00 ± 0% 23.00 ± 0% -8.00% (p=0.000 n=10) geomean 24.95 23.65 -5.20% ¹ all samples are equal
a7c0d28
to
833702e
Compare
Which is your latest PR? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit reduces the number of allocations required to bind args by eliminating string to byte slice conversions for string and time.Time types and by only checking for bind parameters if any of the driver.NamedValue args are named. It also changes bind to only reset the sqlite3 statement when necessary - previously the statement was always reset even on first use (this yields a 3-4% performance boost).