The native binding lane exercises PolyXML's full modern C++20 API (polyxml.hpp) backed by the Rust core engine via the polyxml-c C-ABI. Run:
./benchmarks/cpp/run_runtime.shPrerequisites: A modern C++20 compiler (g++ >= 11 or clang++ >= 13) and Rust.
- Schema Definition: Compiles schemas dynamically with
polyxml::SchemaBuildersupporting nested records and lists (add_list_nested,add_nested,add_element). - Generated Models: Generates modern C++20 models (
batch.hpp) from the sharedbatch.xsdschema usingpolyxml generate --lang cpp. - End-to-End Typed Processing:
- Read: Deserializes raw XML into
polyxml::Valueand extracts strongly typedpolyxml::generated::Batchmodels (std::vector<SensorType>). - Write: Maps
polyxml::generated::Batchintopolyxml::Valuerecords and serializes to conforming XML withpolyxml::serialize.
- Read: Deserializes raw XML into
- Shared Fixtures: Evaluates both the 1-sensor (65 bytes) and 1,000-sensor (53,795 bytes) fixtures from
benchmarks/workloads/sensor-batch/. - Correctness Verifications:
- Asserts exact 1-sensor round trip.
- Asserts 1,000-sensor batch bounds: size 1,000, first item (
sensor-0,0), middle item (sensor-500,500), and last item (sensor-999,999). - Asserts entity escaping and unescaping (
&,<,>). - Asserts strict syntax validation (malformed XML properly throws
polyxml::Exception).
- Repetitions: Runs 5 repeated iterations on steady-state execution reporting
ns/op.
Use BENCH_ITERATIONS_1=1000 BENCH_ITERATIONS_1000=50 ./benchmarks/cpp/run_runtime.sh for quick testing.
Run ./benchmarks/cpp/run.sh from the repository root after cargo build -p polyxml-cli.
Warning
This suite uses a hand-rolled std::string::find search adapter, NOT a conforming XML parser. It was historically used as an adapter sanity check for generated models before full C-ABI nested schema support was added.
Output lines are prefixed with adapter_ (adapter_generated, adapter_baseline). Do not cite these timings as PolyXML C++ XML parser throughput. Refer to the Native C++ binding lane above for true PolyXML C++ benchmarks.