[YANGTOOLS-1316] Re-examine argument storage in effective statements Created: 02/Sep/21 Updated: 08/Dec/21 Resolved: 08/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: | pt | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Epic Link: | Parser Performance | ||||||||||||||||||||||||
| Description |
|
With More specifically, AbstractLeafEffectiveStatement has two specializations, storing argument in an explicit field. This statement is a CopyableNode, hence it may have an 'original' pointer – but when it does not, as is the case for EmptyLeafEffectiveStatement, the argument and declared.argument() should be pointing to the same thing. Hence we should be able to specialize a bit more. This is probably true of many other statements as well. Audit all statements bearing a QName argument. |
| Comments |
| Comment by Robert Varga [ 02/Sep/21 ] |
|
We need to have ditched SchemaNode.getPath() to allow this optimization. |
| Comment by Robert Varga [ 03/Dec/21 ] |
|
Current JOL output:
***** 32-bit VM: ********************************************************** org.opendaylight.yangtools.yang.model.ri.stmt.impl.eff.EmptyLeafEffectiveStatement object internals: OFFSET SIZE TYPE DESCRIPTION VALUE 0 8 (object header) N/A 8 4 org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement Default.declared N/A 12 4 int AbstractLeafEffectiveStatement.flags N/A 16 4 java.lang.Object AbstractLeafEffectiveStatement.substatements N/A 20 4 org.opendaylight.yangtools.yang.common.QName AbstractLeafEffectiveStatement.argument N/A 24 4 org.opendaylight.yangtools.yang.model.api.TypeDefinition AbstractLeafEffectiveStatement.type N/A 28 4 (loss due to the next object alignment) Instance size: 32 bytes Space losses: 0 bytes internal + 4 bytes external = 4 bytes total ***** 64-bit VM: ********************************************************** org.opendaylight.yangtools.yang.model.ri.stmt.impl.eff.EmptyLeafEffectiveStatement object internals: OFFSET SIZE TYPE DESCRIPTION VALUE 0 16 (object header) N/A 16 8 org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement Default.declared N/A 24 4 int AbstractLeafEffectiveStatement.flags N/A 28 4 (alignment/padding gap) 32 8 java.lang.Object AbstractLeafEffectiveStatement.substatements N/A 40 8 org.opendaylight.yangtools.yang.common.QName AbstractLeafEffectiveStatement.argument N/A 48 8 org.opendaylight.yangtools.yang.model.api.TypeDefinition AbstractLeafEffectiveStatement.type N/A Instance size: 56 bytes Space losses: 4 bytes internal + 0 bytes external = 4 bytes total Reusing argument would save 8 bytes (25% and 14%), but would not change the picture with compressed references. In terms of the Junos test case this means saving 400KiB.
|