Tier 1 · ayaml
scanner only / ayaml scan
Lexical scanner (tokenizer only)
Scans UTF-8 YAML bytes into low-level lexical tokens (block indicators, quoted/plain
scalar boundaries, flow punctuation, anchors) without building a syntax tree or
validating mapping keys. Exposed behind the unstable bench-internals
feature strictly to measure the raw byte-scanning ceiling; on
14 of 26 fixtures it
allocates zero heap bytes.
Tier 1 Baseline · ayaml
pull events / ayaml::parse_events
Streaming pull-event parser
Public YAML 1.2.2 pull iterator yielding semantic events (DocumentStart,
MappingStart, Scalar, SequenceEnd, ...) one at a
time on demand. Callers consume and drop each event immediately (live_bytes = 0),
keeping peak heap flat around 42.0 KiB on multi-line block documents from 10 KiB to 1 MiB.
Reaches 2456.2 MiB/s on 1 MiB plain scalars.
Tier 1 & Tier 2 · ayaml
Tape DOM / parse_tape
Safe flat-array zero-copy DOM
Builds a read-only, cache-friendly tree inside a single contiguous 16-byte-per-node
Vec while borrowing unmodified scalars as zero-copy &str
slices from the original input buffer. Enforces full YAML 1.2.2 Core schema typing,
duplicate-key rejection, and DoS limits in pure safe Rust. Cold parse_tape
is 1.43x faster than
Value DOM with 1.51x less peak heap
and 140x fewer heap allocations.
Tier 1 & Tier 2 · ayaml
Tape + ParserBuf / ayaml tape-reuse
Warm buffer recycling for bulk loops
Pairs Tape, OwnedTape, or EventStream with a
reusable ParserBuf scratch buffer via buf.parse_tape(input),
buf.parse_events(input), and recycle_into(&mut buf).
When parsing thousands of YAML documents in a loop, internal vectors retain their
allocated capacity for zero-allocation steady-state parsing
(1.46x faster than
Value DOM). Timed-only in tables (matching rapidyaml parse-reuse)
so cold memory ratios stay apples-to-apples.
Tier 2 Baseline · Rust / C++ DOMs
Value DOM / parse_value
Owned mutable dynamic tree
Parses YAML into an owned, mutable in-memory value enum (Value::Mapping,
Value::Sequence, Value::String, integers, floats, booleans,
null). In ayaml, Mapping preserves key insertion order
(backed privately by indexmap) and rejects duplicate keys. Peers in this tier include
yaml-rust2, saphyr, noyalib,
fast-yaml-core, yaml-serde, and C++ fkYAML.
Typed & Compat Serde
from_str_borrowed / serde Value / compat serde
Direct Serde struct decoding & compatibility profiles
ayaml::from_str and ayaml::from_str_borrowed stream directly
from pull events into your Rust struct with zero intermediate DOM;
from_str_borrowed borrows unescaped &'a str fields in
place. ayaml (serde Value) deserializes into ayaml::Value via
Serde to measure Serde dispatch overhead. ayaml (compat serde) enables the
additive libyaml-compat profile for libyaml-compatible legacy inputs
(duplicate keys, under-indented flow continuations, and optional global-tag dropping
while keeping YAML 1.2.2 scalar resolution).
serde-saphyr (JSON Value) targets serde_json::Value because
serde-saphyr does not expose a native YAML Value DOM.
Tier 1 · Diagnostics & Editing
SpannedTree / Spanned<T>
Byte-accurate source spans on every node
Attaches exact byte-offset Span ranges (start..end) to every
node in a parsed tree (SpannedTree::parse, with full read-only
SpannedNode traversal) or to individual typed Serde
fields (Spanned<T>). Combined with LineIndex (UTF-8,
Unicode scalar, or LSP UTF-16 columns) and ayaml-edit, this powers
diagnostic underlines, config validators, and verified comment-preserving edits.
Tier 1 · Unsafe C Peers
libyaml / libfyaml (events, load, doc)
Reference C event streams and C document trees
libyaml events and libfyaml events are C pull-event APIs
comparable to ayaml::parse_events (each event is pulled and discarded
immediately). libyaml load and libfyaml doc materialize C
document node structures in memory without Rust ownership or typed Value
conversion (libfyaml is compiled with portable C flags
HAVE_PORTABLE_TARGET=1).
Tier 1 & Tier 2 · Unsafe C++ Arena
rapidyaml (C++ arena)
Four rapidyaml C++ arena benchmark modes
rapidyaml parses raw bytes into a flat unsafe C++ index array with coarse
arena allocations, skipping Rust UTF-8 ownership checks and duplicate-key hashing. Our
benchmarks measure all four of its documented modes transparently:
parse-in-place
-
Mutates and overwrites the caller's input byte buffer in place during
unescaping so scalar strings need not be copied. Fastest raw structural parse, but
requires mutable input ownership and destroys the original YAML text.
parse-arena
-
Cold structural parse from an immutable input buffer into a freshly allocated C++
flat arena (copies input bytes into the arena without resolving scalar types).
parse-reuse
-
Reuses an already-warmed C++ arena across parses (analogous to
ayaml's
safe Tape + ParserBuf). Timed-only so cold heap numbers are not skewed.
resolve-typed
-
Walks the parsed C++ arena and resolves scalar types (null, bool, int, float,
string). Closest Tier 2 comparison to DOM parsers, though still without owned Rust
Value trees, duplicate-key rejection, or memory safety.
Serialization
emit / to_string / ayaml-edit
Deterministic YAML emission vs. source-preserving edits
Emission benchmarks measure serializing an already-parsed document back into canonical
YAML text. ayaml quotes YAML 1.2 Core-schema scalars (null,
true, false, numbers) and YAML 1.1 leading-zero numerals
(such as 0644) so emitted strings round-trip unambiguously across YAML 1.1
and YAML 1.2 consumers, reaching up to
242.0 MiB/s. When you need to update a field
while preserving existing comments, blank lines, and formatting, use the companion
ayaml-edit crate instead of full
re-emission.