GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||
GeezerVison is showing github.com — perf: trim per-parse allocations that do no work by knutwannheden · Pull Request #2874 · JSQLParser/JSqlParser Conversation
|
| run | master | this branch | 5.4 (master run / branch run) | |
|---|---|---|---|---|
| 1 | time | 39.07 ± 2.05 ms/op | 38.19 ± 1.39 ms/op | 49.52 / 48.21 ms/op |
| 1 | alloc | 7,166,709 B/op | 6,118,424 B/op (−14.6%) | 7,767,862 / 7,751,289 |
| 2 | time | 39.56 ± 1.90 ms/op | 38.55 ± 1.84 ms/op | 48.71 / 49.66 ms/op |
| 2 | alloc | 7,183,726 B/op | 6,084,685 B/op (−15.3%) | 7,784,537 / 7,767,974 |
The branch is 2.4% faster in both runs while the 5.4 control moves 2% either way, so the time difference is at the edge of what this benchmark resolves. The allocation difference is not in doubt.
The Condition() change edits the same lines as #2870, so whichever merges second has a small conflict to resolve. Both deques can then be created together at the first NOT or !.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
`Condition()` created a deque for leading `NOT` and `!` prefixes on every call, though few conditions have one. An empty `ArrayDeque` allocates its 17-slot array up front, so parsing `performance.sql` allocated 585 KB per parse for deques that stayed empty. The deque is now created at the first `NOT` or `!`.
`KeyWord.from` runs for every `LIKE`-family condition the parser builds, and `String.replaceAll` compiled its `\s+` pattern on each call. Parsing `performance.sql` allocated 201 KB per parse for those compilations. The pattern is now a precompiled constant.
…t use `PrimaryExpression()` created two lists on every call: one for chained signs such as `- -1` and one for JSON operators such as `->`. Nearly every primary expression has neither, so both lists usually stayed empty. They are now created at their first element.
`consumeXmlLeadingKeyword` and `FunctionArgumentList` called `Function.getName()` for every function to check for `XMLPARSE`, `XMLELEMENT` or `XMLFOREST`, and `getName()` joins the name parts into a new string on each call. Both checks now compare the single name part.
There was an error while loading. Please reload this page.
|
Good work, thank you much for tracing and improving this! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Conflicts in JSqlParserCC.jjt, resolved by keeping master's logic and re-adding the node links on top: - PARTITION BY (JSQLParser#2878): the four sites call ComplexExpressionList() directly and still link the PARTITION BY node. - PrimaryExpression (JSQLParser#2874): innerSigns is null without an inner sign, so the loop that wraps and links signed values is guarded. - Condition (JSQLParser#2874): one lazily created deque of NOT tokens carries both the token for the node and whether it was spelled "!".
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.