amazon-ion / ion-python

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

Added and Plumbed IonPyValueModel Flags #322

Closed rmarrowstone closed 6 months ago

rmarrowstone commented 6 months ago

This change adds an IonPyValueModel IntEnum to allow users to control how Ion values map to IonPy and/or standard Python types when reading.

As noted previously, emitting "bare" values is significantly faster than emitting IonPy values. I also added flags to affect how Symbols and Structs map, though they are not yet supported. Profiling revealed that using Python std types for these two had the most impact on perf, aside from Timestamps which we are tackling independently.

My plan is to make these two flags work in the c-extension, evaluate and go from there.

Reviewer's Note: I put this into CR as-is to get some feedback on the naming and semantics of the flags. I don't intend to merge any flags exposed to the user that aren't implemented, at least in the c-extension.

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