#67 optimization: use Python primitive types for values representing simple types

PyXB 2.0.0
Generation Model
PyXB 1.1.0

A Python int natively consumes 4 bytes. A pyxb.bindings.datatypes.int instance consumes 362 bytes. This is primarily due to the need to associate per-instance meta information like an xsi:nil setting.

Values that are fundamentally Python primitive types should be stored as instances of those types whenever possible. This should apply to any instance of a simple type that derives from a Python primitive type, whether the instance is content in an element or value for an attribute.

Cases where this will not be possible include:

  • Occurrence as simple content element value that incorporates attributes, including xsi:nil="true" but excluding xsi:nil="false".

This optimization will also eliminate association with schema types and elements. The infrastructure that preserves document-order of elements in content is likely to become more complex. All this will have an impact on the speed and correctness of validation.