[YANGTOOLS-1082] Stop phase completion early Created: 14/Feb/20  Updated: 17/Feb/20  Resolved: 17/Feb/20

Status: Resolved
Project: yangtools
Component/s: parser
Affects Version/s: None
Fix Version/s: 5.0.0, 3.0.10, 4.0.8

Type: Story Priority: Medium
Reporter: Robert Varga Assignee: Robert Varga
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: Parser Performance

 Description   

Profiling shows that StatementContextBase.tryToCompletePhase() is our single hottest method during large context assembly - having ~52.5M calls.

Splitting it up shows, that 99% of time spent in it ends up being spent in StatementContextBase.completeChildren(), also implying recursive invocation of tryToCompletePhase().

Since each StatementContextBase tracks its finished phase, we should be able stop processing early by simple comparison - which results in trimming down the number of invocations down of tryToCompletePhase() to ~10.5M and completeChildren() to ~4.3M.

In order to reap the benefits of this optimization, though, we must ensure that any children added do transition to the same phase.

 


Generated at Wed Feb 07 20:55:08 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.