-
Story
-
Resolution: Done
-
Medium
-
None
-
None
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.