Skip to content

Don't allocate unnecessary LazySymbolTableProvider instances #1053

Description

@tgregg

See IonValueLite.getFieldNameSymbol(): https://github.com/amazon-ion/ion-java/blob/master/src/main/java/com/amazon/ion/impl/lite/IonValueLite.java#L583

In this case, the symbol table is only retrieved once, so the parameterless variant of the method does not need a LazySymbolTableProvider at all. Although it seems like the JVM should be able to optimize away this allocation, we have profiles that show this not happening.

It looks like symbolValue(), stringValue() and getTypeAnnotationSymbols() could be similarly optimized.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions