Repository navigation
Commit f162cfe
authored
perf: drop the list-form probes in ExpressionList (#2877)
`ExpressionList()` ran three 3-token lookaheads to choose between the
complex, simple and parenthesed list forms, and `ParenthesedExpressionList()`
scanned into the list on the parse path to tell an empty body from a
non-empty one. Together they took about 5% of parser CPU on
`performance.sql`.
The probes decided nothing: `ComplexExpressionList()` accepts every list
the other two forms do, including `()` and bracketed operands such as
`( 1 + a ) / ( 1 + b )`, so it won wherever they could have. It is now
called directly, and the parenthesed body is guarded by the token kind of
the closing bracket. Parser CPU per parse drops from 29.0 ms to 27.7 ms
(-4.5%, three interleaved pairs, on top of #2876), and `./gradlew jmh`
from 32.67 to 28.54 ms/op.1 parent 83f9066 commit f162cfe
2 files changed
Lines changed: 15 additions & 23 deletions
File tree
- src
- main/jjtree/net/sf/jsqlparser/parser
- test/java/net/sf/jsqlparser/expression
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12723 | 12723 | | |
12724 | 12724 | | |
12725 | 12725 | | |
12726 | | - | |
12727 | | - | |
12728 | | - | |
12729 | | - | |
12730 | | - | |
12731 | | - | |
12732 | | - | |
12733 | | - | |
12734 | | - | |
12735 | | - | |
12736 | | - | |
12737 | | - | |
12738 | | - | |
12739 | | - | |
12740 | | - | |
12741 | | - | |
12742 | | - | |
| 12726 | + | |
| 12727 | + | |
| 12728 | + | |
12743 | 12729 | | |
12744 | 12730 | | |
12745 | 12731 | | |
| |||
12771 | 12757 | | |
12772 | 12758 | | |
12773 | 12759 | | |
12774 | | - | |
12775 | | - | |
12776 | | - | |
12777 | | - | |
12778 | | - | |
| 12760 | + | |
12779 | 12761 | | |
12780 | 12762 | | |
12781 | 12763 | | |
| |||
12843 | 12825 | | |
12844 | 12826 | | |
12845 | 12827 | | |
12846 | | - | |
| 12828 | + | |
12847 | 12829 | | |
12848 | 12830 | | |
12849 | 12831 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
157 | 157 | | |
158 | 158 | | |
159 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
160 | 170 | | |
0 commit comments