Skip to content
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

Use Scanning Replace for Parameter Tokenization #24

Merged
merged 2 commits into from
Oct 18, 2023

Conversation

benjic
Copy link
Contributor

@benjic benjic commented Oct 17, 2023

This utilizes a scanner to build a new sql statement to linearize the process. This helps performance dramatically as we don't have to loop through the string to replace arguments multiple times. The included benchmark shows a 950.10% performance improvement for statements with 1000 parameters.

Benchmark Data

Below is the data collected comparing the two implementations.

chart (1)

Parameter Count Performance Change
1 -4.66%
2 45.00%
10 256.71%
100 665.25%
1000 850.10%

The case of as single parameter is slower by 5% but larger number of substitutions are dramatically faster.

@benjic benjic marked this pull request as ready for review October 17, 2023 21:50
@nullism nullism merged commit e10101f into nullism:main Oct 18, 2023
1 check failed
@nullism
Copy link
Owner

nullism commented Oct 18, 2023

Thanks for doing this Ben!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants