ion-java
ion-java copied to clipboard
Improve transition to large size in IonStructLite
transitionToLargeSize
is called only in IonContainerLite.nextSize
, and the call_transition
boolean there is always true
.
transitionToLargeSize
has only one non-trivial implementation, in IonStructLite
, and that implementation ignores the input size.
If we bleed field name concerns into IonValue
, why not bleed field map concerns into IonContainerLite
? transitionToLargeSize
could be renamed fieldMapIsActive
and used all the same. Or transitionToLargeSize
could call fieldMapIsActive
.
Alternatively, it might bear a little more looking at IonContainerLite.nextSize
and the IonStructLite
interactions to see whether nextSize
really does need to ensure this property. Does it, really, if the field map is lazy and this property is ensured wherever it may need access? Perhaps we can do away with transitionToLargeSize
entirely.
Originally posted by @jobarr-amzn in https://github.com/amazon-ion/ion-java/pull/557#discussion_r1320211875
We now have logic in IonStructLite to lazily construct the field map. We should explore eliminating transitionToNextSize
, which is called when elements are added, in favor of only lazy construction. The performance impacts of this on existing use cases would need to be measured.