[YANGTOOLS-1067] Use flyweight EffectiveStatement implementations Created: 11/Jan/20 Updated: 04/Dec/21 Resolved: 04/Dec/21 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | parser |
| Affects Version/s: | None |
| Fix Version/s: | 8.0.0 |
| Type: | Improvement | Priority: | Medium |
| Reporter: | Robert Varga | Assignee: | Robert Varga |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Σ Remaining Estimate: | Not Specified | Remaining Estimate: | Not Specified |
| Σ Time Spent: | Not Specified | Time Spent: | Not Specified |
| Σ Original Estimate: | Not Specified | Original Estimate: | Not Specified |
| Attachments: |
|
||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||
| Sub-Tasks: |
|
||||||||||||||||||||
| Epic Link: | Parser Performance | ||||||||||||||||||||
| Description |
|
Most EffectiveStatement subtrees are inlined via grouping/uses mechanics, which we gain control of via Since most effective statements have a SchemaPath, their state depends on it and thus we cannot reasonably share state – this property cascades to parent substatement list – hence we can share very little. Once we get rid of SchemaPath, though, each effective statement's state is (mostly?) dominated by its QName (which dictates substatements' QNames, etc.), hence we can deploy a very efficient flyweight pattern, where we maintain a QNameModule -> template cache and aggressively reuse effective statements. |
| Comments |
| Comment by Robert Varga [ 14/Jan/20 ] |
|
Note that CopyHistory and parent's 'isConfiguration' are also contributing to that state (but we should get that at buildEffective() time from |
| Comment by Robert Varga [ 03/Dec/20 ] |
|
The primary goal here is to eliminate duplicate lists (note Object[] is used by RegularImmutableList, too)
|
| Comment by Robert Varga [ 03/Dec/20 ] |
|
These typically consist of CopyPolicy.CONTEXT_INDEPENDENT:
hence the list should be readily shared |
| Comment by Robert Varga [ 12/Feb/21 ] |
|
Unfortunately the current mode of operation causes a significant CPU regression without any real benefit. This will need to be revisited. |
| Comment by Robert Varga [ 02/Sep/21 ] |
|
with SchemaPath out of the picture, the situation is much better, but there is obviously still room for improvement. |