- Rust 64.1%
- C 11.9%
- C++ 10.6%
- Python 10.5%
- Shell 2.9%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| benches | ||
| crates/yaml-c-ffi | ||
| scripts | ||
| src | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| LICENSE-APACHE | ||
| LICENSE-MIT | ||
| NOTICE | ||
| README.md | ||
ayaml-benchmarks
Standalone, reproducible comparative YAML benchmark and allocation harness for
ayaml.
This repository lives outside zeropier/ayaml so the main ayaml workspace
remains 100% pure Rust (#![forbid(unsafe_code)]) with zero C/C++ build
dependencies, while allowing any engineer to inspect, verify, and re-run every
Rust, C, and C++ peer comparison end-to-end.
What is measured
All benchmarks consume the deterministic, SHA-256-verified fixture catalog from
ayaml-fixtures (26 curated scenarios spanning realistic domain workloads, the
4 KiB boundary fixtures, 10 KiB / 100 KiB / 1 MiB scaling ladders, and
structural stress shapes):
- Tier 1 (Zero-copy & structural):
ayaml:scan(tokenizer viabench-internals),events(public pull-basedayaml::parse_eventsiterator),tape(cold flat-arrayparse_tape/parse_tape_documents),tape-reuse(warmParserBuf+recycle_into),spanned(SpannedTree)astral-yaml(0.0.8):spanned(astral_yaml::parse, spanned + commented arenaStream)rapidyaml(v0.16.0):parse-arena,parse-in-place,parse-reuselibyaml(0.2.6):events,load(all documents in multi-doc streams)libfyaml(v1.0.0-rc2):events,doc
- Tier 2 (Full semantic / typed DOM & Serde):
ayaml:value(parse_value/parse_documents),serde-value,compat-serde,typed,borrowed,tape-typed,tape-borrowedastral-yaml(0.0.8/astral-yaml-serde 0.0.8):value,typed,borrowedrapidyaml(v0.16.0):resolve-typedfkyaml(v0.5.0):parse(DOM construction + O(1) root check, no extra traversal)noyalib(0.0.63):value,typed,borrowedfast-yaml-core(0.7.0):parsesaphyr(0.3.3):parseserde-saphyr(2.2.0):serde-json(targetsserde_json::Value),typedyaml-rust2(0.13.0):parseyaml-serde(0.10.7):value,typed
- YAML emission (speed & memory, verified by semantic round-trip oracle):
- All 12 emitting libraries (
ayaml,astral-yamlvia flow-onlyastral_yaml_serde::to_string,rapidyaml,fkyaml,libyaml,libfyaml,noyalib,fast-yaml-core,saphyr,serde-saphyrfromserde_json::Value,yaml-rust2,yaml-serde) acrossfrontmatter-tiny,ci-workflow,openapi-spec,escape-routes,unicode-multibyte,lockfile-wide, andscale-openapi-100kb.
- All 12 emitting libraries (
Mandatory pre-timing semantic oracle
Before any timing or allocation run starts, src/oracle.rs verifies that every
parser's parsed output matches ayaml semantically across every supported
fixture, that typed struct decodes produce identical Rust structs, and that
every measured YAML emitter round-trips semantically identically through
ayaml::parse_value. Silent semantic mismatches abort the benchmark
immediately; genuine upstream capability gaps (e.g., single-document APIs on
multi-doc streams, parsers rejecting explicit mapping keys, or fixture-specific
upstream emitter incompatibilities) are recorded in structured exclusions[]
inside schema-v2 fingerprint.json rather than silently mismeasured.
Quick start
# 1. Verify vendored C/C++ shims, allocation tracking, and full semantic oracle
cargo test --workspace --all-features --locked
python3 scripts/test_export_jsonl.py
# 2. Run 3 Criterion rounds + exact counting-allocator probe (pinned to CPU 2)
chmod +x scripts/run_benchmarks.sh
./scripts/run_benchmarks.sh --rounds 3 --cpu 2
# 3. Export canonical speed.jsonl, memory.jsonl, and schema-v2 fingerprint.json
python3 scripts/export_jsonl.py \
--raw target/raw-capture \
--out results/run
export_jsonl.py automatically extracts canonical peer_versions,
harness_deps, vendored C/C++ pins from VENDOR.md, scenarios[] from
ayaml-fixtures, and structured exclusions[] from competitive_mem --print-metadata. To benchmark a local ayaml checkout, pass
--ayaml-path <path> to scripts/run_benchmarks.sh.
Vendored C/C++ peers
See crates/yaml-c-ffi/VENDOR.md for exact
upstream versions, MIT licenses, SHA-256 checksums, and compiler flags.
License
Dual-licensed under Apache-2.0 or MIT (same as ayaml). Vendored C/C++
libraries retain their upstream MIT licenses.