[YANGTOOLS-1194] Reduce StatementSourceReference proliferation Created: 03/Dec/20 Updated: 03/Dec/20 Resolved: 03/Dec/20 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | parser |
| Affects Version/s: | None |
| Fix Version/s: | 7.0.0 |
| Type: | Improvement | 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 | ||
| Issue Links: |
|
||||||||
| Epic Link: | Parser Performance | ||||||||
| Description |
|
We have a large number of users who assume acquiring CommonStmtContext.sourceReference() is cheap, which is not really the case. Most of the time the reference is acquired only for the purposes of throwing an exception – which we rarely really do. Refactor SourceException and its subclasses to offer instantiation with CommonStmtCtx, calling sourceReference() only if an exception is about to be thrown. This should help with code verbosity as well as improve performance. |