Use flyweight EffectiveStatement implementations
Description
Attachments
- 02 Sep 2021, 02:43 PM
- 03 Dec 2020, 06:16 PM
- 03 Dec 2020, 06:16 PM
is blocked by
relates to
Activity
Robert Varga September 2, 2021 at 2:47 PM
with SchemaPath out of the picture, the situation is much better, but there is obviously still room for improvement.
Robert Varga February 12, 2021 at 10:30 AM
Unfortunately the current mode of operation causes a significant CPU regression without any real benefit. This will need to be revisited.
Robert Varga December 3, 2020 at 6:17 PM
These typically consist of CopyPolicy.CONTEXT_INDEPENDENT:
hence the list should be readily shared
Robert Varga December 3, 2020 at 6:16 PMEdited
The primary goal here is to eliminate duplicate lists (note Object[] is used by RegularImmutableList, too)
Robert Varga January 14, 2020 at 1:48 PM
Note that CopyHistory and parent's 'isConfiguration' are also contributing to that state (but we should get that at buildEffective() time from https://lf-opendaylight.atlassian.net/browse/YANGTOOLS-694#icft=YANGTOOLS-694). The overall matrix of possible states is nevertheless quite small and amenable to caching.
Most EffectiveStatement subtrees are inlined via grouping/uses mechanics, which we gain control of via YANGTOOLS-694.
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.