davisp opened a new pull request, #1587:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1587
This basically just takes the approach proposed by @alamb in #1561 and runs
with it.
The main changes involved:
1. A number of token parsing methods introduced that return a
`&TokenWithSpan` instead of a cloned `TokenWithSpan`.
2. A bunch of updates to make use of these new ref returning functions.
3. Refactoring some of the core peek/expect/consume methods to avoid
unnecessary clones
4. Replace all but one use of expect_keyword with expect_keyword_is.
Results on my M1 MacBook Pro:
```
# main:00abaf218
❯ cargo bench -- --save-baseline main
Finished `bench` profile [optimized] target(s) in 0.11s
Running benches/sqlparser_bench.rs
(target/release/deps/sqlparser_bench-9f7a6e6e193d8f5c)
sqlparser-rs parsing benchmark/sqlparser::select
time: [4.2036 µs 4.2197 µs 4.2372 µs]
change: [-2.4618% -2.1421% -1.8071%] (p = 0.00 <
0.05)
Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
6 (6.00%) high mild
3 (3.00%) high severe
Benchmarking sqlparser-rs parsing benchmark/sqlparser::with_select:
Collecting 100 samples in estimated 5.0715 s (278k iteratio
sqlparser-rs parsing benchmark/sqlparser::with_select
time: [18.360 µs 18.425 µs 18.486 µs]
change: [-5.3763% -2.5663% -0.8662%] (p = 0.02 <
0.05)
Change within noise threshold.
# reduce-token-cloning:1ffa2aa4
❯ cargo bench -- --baseline main
Compiling sqlparser v0.52.0
(/Users/davisp/github/davisp/datafusion-sqlparser-rs)
Compiling sqlparser_bench v0.1.0
(/Users/davisp/github/davisp/datafusion-sqlparser-rs/sqlparser_bench)
Finished `bench` profile [optimized] target(s) in 15.76s
Running benches/sqlparser_bench.rs
(target/release/deps/sqlparser_bench-9f7a6e6e193d8f5c)
sqlparser-rs parsing benchmark/sqlparser::select
time: [2.9006 µs 2.9020 µs 2.9034 µs]
change: [-31.254% -31.013% -30.769%] (p = 0.00 <
0.05)
Performance has improved.
Found 10 outliers among 100 measurements (10.00%)
4 (4.00%) low mild
2 (2.00%) high mild
4 (4.00%) high severe
Benchmarking sqlparser-rs parsing benchmark/sqlparser::with_select:
Collecting 100 samples in estimated 5.0415 s (364k iteratio
sqlparser-rs parsing benchmark/sqlparser::with_select
time: [13.785 µs 13.813 µs 13.843 µs]
change: [-25.054% -24.778% -24.494%] (p = 0.00 <
0.05)
Performance has improved.
Found 2 outliers among 100 measurements (2.00%)
2 (2.00%) high mild
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]