Self-contained benchmark comparing PolyXML native JSON APIs (polyxml.loads_json, dumps_json, JsonParser, JsonSerializer) against the xsdata JSON data-binding runtime on the exact same Python dataclass models and JSON bytes.
- Small Sensor Telemetry (
SensorReading): Flat entity with 6 scalar fields (~128 bytes JSON). - Nested Order (
Order): Nested domain entity with 10 line items, optional fields, and attribute mappings (~793 bytes JSON). - Repeated Batch (
SensorBatch): Collection of 100 sensor readings (~12.8 KB JSON).
Every run verifies:
assert poly_parsed == expected == xs_parsedfor all payloads.- JSON emitted by
polyxmlis validated by parsing it back into typed models. - Deserialization and serialization are timed separately.
From the repository root with virtual environment activated:
# Smoke test (5 iterations):
./benchmarks/python-json/run.sh --smoke
# Full benchmark (50 iterations, with raw JSON & Markdown output):
./benchmarks/python-json/run.sh --iterations 50 --output-json docs/benchmarks/data/2026-09-26/python-json.json --output-md docs/benchmarks/data/2026-09-26/python-json.md