-
Notifications
You must be signed in to change notification settings - Fork 11
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
Improve parser creation formance. #57
Merged
Merged
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
This move creates a huge different in Parser::new, and when I say, huge I say 1444%. SmallVec triggers too many memmoves. ```bash Running benches/sqlparser_bench.rs (target/release/deps/sqlparser_bench-90367034c12b9cef) sqlparser-rs parsing benchmark/sqlparser::select time: [257.62 ns 258.12 ns 258.69 ns] sqlparser-rs parsing benchmark/sqlparser::select time: [3.9573 µs 3.9604 µs 3.9654 µs] change: [+1443.7% +1449.0% +1453.8%] (p = 0.00 < 0.05) Performance has regressed. ``` Signed-off-by: Pere Diaz Bou <[email protected]>
Signed-off-by: Pere Diaz Bou <[email protected]>
@gwenn ping :) |
@pereman2 pong :) |
I can reproduce your results: sqlparser_bench % cargo bench # master
sqlparser-rs parsing benchmark/sqlparser::select
time: [15.510 µs 16.289 µs 17.324 µs]
Found 11 outliers among 100 measurements (11.00%)
8 (8.00%) high mild
3 (3.00%) high severe
sqlparser-rs parsing benchmark/sqlparser::with_select
time: [31.396 µs 32.301 µs 33.468 µs]
Found 8 outliers among 100 measurements (8.00%)
5 (5.00%) high mild
3 (3.00%) high severe sqlparser_bench % cargo bench # your branch
sqlparser-rs parsing benchmark/sqlparser::select
time: [433.49 ns 435.21 ns 437.12 ns]
change: [-97.356% -97.272% -97.198%] (p = 0.00 < 0.05)
Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
3 (3.00%) high mild
8 (8.00%) high severe
sqlparser-rs parsing benchmark/sqlparser::with_select
time: [445.34 ns 447.70 ns 450.63 ns]
change: [-98.615% -98.579% -98.548%] (p = 0.00 < 0.05)
Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
3 (3.00%) high mild
7 (7.00%) high severe |
Nice |
Merged
In fact, you were benchmarking
|
Closed
oh wow didn't notice |
But you made |
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.
Hello and sorry for the intrusion but... I was running some benchmark for https://github.com/penberg/limbo and I found out Parser::new was doing a whole bunch of
memmove
due to the stack approach used by SmallVec. This PR removes SmallVec in favor of Vec as you will see proven as worth it, by the benchmarks you guys have insidebenches/sqlparser_bench.rs
:This move creates a huge different in Parser::new, and when I say huge, I say a whopping 1444% difference. SmallVec triggers too many memmoves.