amazon-ion / ion-python

A Python implementation of Amazon Ion.
https://amazon-ion.github.io/ion-docs/
Apache License 2.0
260 stars 51 forks source link

Emit SymbolTokens for Symbol "bare values" #318

Closed rmarrowstone closed 11 months ago

rmarrowstone commented 11 months ago

This change makes it so that Symbols are emitted as Symbol Tokens when emit_bare_values is true. This gets most of the associated performance gains for Symbols while still avoiding any type ambiguity between Symbols and Strings.

Since IonPySymbol inherits from SymbolToken users may still check if and act on a value being a Symbol with a single type check regardless of "bare-ness." I changed the benchmark spec because it broke in my own testing.

The flag is still not exposed to users so it shouldn't change anyone's experience.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.