Repository navigation
Commit 4b983b2
authored
perf: trim per-parse allocations that do no work (#2874)
* perf: create the deque of NOT prefixes only for a negated condition
`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 `!`.
* perf: precompile the whitespace pattern of LikeExpression.KeyWord.from
`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.
* perf: create PrimaryExpression's sign and JSON operator lists on first 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.
* perf: match XML function names without joining the name parts
`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.1 parent a0e0861 commit 4b983b2
2 files changed
Lines changed: 40 additions & 16 deletions
File tree
- src/main
- java/net/sf/jsqlparser/expression/operators/relational
- jjtree/net/sf/jsqlparser/parser
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
174 | 175 | | |
175 | 176 | | |
176 | 177 | | |
| 178 | + | |
| 179 | + | |
177 | 180 | | |
178 | 181 | | |
179 | | - | |
| 182 | + | |
180 | 183 | | |
181 | 184 | | |
182 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1333 | 1333 | | |
1334 | 1334 | | |
1335 | 1335 | | |
1336 | | - | |
1337 | | - | |
1338 | | - | |
1339 | | - | |
1340 | | - | |
1341 | | - | |
| 1336 | + | |
| 1337 | + | |
1342 | 1338 | | |
1343 | 1339 | | |
1344 | 1340 | | |
| |||
1358 | 1354 | | |
1359 | 1355 | | |
1360 | 1356 | | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
1361 | 1363 | | |
1362 | 1364 | | |
1363 | 1365 | | |
| |||
12181 | 12183 | | |
12182 | 12184 | | |
12183 | 12185 | | |
12184 | | - | |
| 12186 | + | |
12185 | 12187 | | |
12186 | 12188 | | |
12187 | 12189 | | |
12188 | 12190 | | |
12189 | 12191 | | |
12190 | 12192 | | |
12191 | | - | |
| 12193 | + | |
| 12194 | + | |
| 12195 | + | |
| 12196 | + | |
| 12197 | + | |
| 12198 | + | |
| 12199 | + | |
12192 | 12200 | | |
12193 | 12201 | | |
12194 | 12202 | | |
| |||
12258 | 12266 | | |
12259 | 12267 | | |
12260 | 12268 | | |
12261 | | - | |
| 12269 | + | |
12262 | 12270 | | |
12263 | 12271 | | |
12264 | 12272 | | |
| |||
13193 | 13201 | | |
13194 | 13202 | | |
13195 | 13203 | | |
13196 | | - | |
| 13204 | + | |
13197 | 13205 | | |
13198 | 13206 | | |
13199 | 13207 | | |
13200 | 13208 | | |
13201 | 13209 | | |
13202 | 13210 | | |
13203 | | - | |
| 13211 | + | |
13204 | 13212 | | |
13205 | 13213 | | |
13206 | 13214 | | |
13207 | 13215 | | |
13208 | 13216 | | |
13209 | 13217 | | |
13210 | | - | |
| 13218 | + | |
| 13219 | + | |
| 13220 | + | |
| 13221 | + | |
| 13222 | + | |
| 13223 | + | |
| 13224 | + | |
| 13225 | + | |
| 13226 | + | |
13211 | 13227 | | |
13212 | 13228 | | |
13213 | 13229 | | |
| |||
13406 | 13422 | | |
13407 | 13423 | | |
13408 | 13424 | | |
| 13425 | + | |
| 13426 | + | |
| 13427 | + | |
13409 | 13428 | | |
13410 | 13429 | | |
13411 | 13430 | | |
| |||
13425 | 13444 | | |
13426 | 13445 | | |
13427 | 13446 | | |
13428 | | - | |
13429 | | - | |
| 13447 | + | |
| 13448 | + | |
| 13449 | + | |
| 13450 | + | |
13430 | 13451 | | |
13431 | 13452 | | |
13432 | 13453 | | |
| |||
15421 | 15442 | | |
15422 | 15443 | | |
15423 | 15444 | | |
15424 | | - | |
| 15445 | + | |
15425 | 15446 | | |
15426 | 15447 | | |
15427 | 15448 | | |
| |||
0 commit comments