Commit 5fdf6b7
authored
Optimize logical nodes visit methods. (perplexhub#166)
This commit provides memory optimization when visiting `LogicalNode`'s children.
Old implementation was invoking `LogicalNode#getChildren` which makes shallow copy
of its children nodes to only iterate over it we can use the fact that `LogicalNode`
is in fact `java.lang.Iterable` and use enhanced for loop to iterate over it.
Using it that way is more memory efficient and does not involve shallow copying
because iterator returned by `LogicalNode` is unmodifiable.1 parent 9d80154 commit 5fdf6b7
File tree
1 file changed
+15
-3
lines changed- rsql-jpa/src/main/java/io/github/perplexhub/rsql
1 file changed
+15
-3
lines changedLines changed: 15 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
429 | 431 | | |
430 | 432 | | |
431 | 433 | | |
432 | | - | |
433 | | - | |
| 434 | + | |
434 | 435 | | |
435 | 436 | | |
436 | 437 | | |
437 | 438 | | |
438 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
439 | 451 | | |
440 | | - | |
| 452 | + | |
441 | 453 | | |
442 | 454 | | |
0 commit comments