Reduce sqlite bind overhead#1385
Merged
Merged
Conversation
This file contains hidden or 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
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 change reduces overhead in the statement binding path.
It removes redundant bind logic, avoids an extra string-to-byte-slice copy when binding text values, and caches named parameter index lookups per prepared statement.
The main effect is lower overhead on parameterized execution paths, especially for repeated statement use and named parameters.
Validation was done with:
go test ./...go test -run ^ -bench 'BenchmarkSuite/(BenchmarkExec|BenchmarkQuery|BenchmarkParams|BenchmarkStmt|BenchmarkQueryParallel)$' -benchmem -benchtime=200msBenchmarkExec3580 ns/op3499 ns/op-81 ns/op2.3%BenchmarkQuery8418 ns/op8395 ns/op-23 ns/op0.3%BenchmarkParams9084 ns/op8835 ns/op-249 ns/op2.7%BenchmarkStmt5864 ns/op5858 ns/op-6 ns/op0.1%BenchmarkQueryParallel3169 ns/op3139 ns/op-30 ns/op0.9%