Performance Metrics

Performance Benchmarks & Throughput

Six dedicated Criterion benchmark suites measuring zero-copy slice extraction, multi-format parsing, and HTML meta tag synthesis.

Frontmatter Gen ships with six reproducible Criterion.rs benchmark suites under benches/ covering every stage of the pipeline from zero-copy fence splitting to full static site page rendering.

0 B
Extractor Heap Copy
6 Suites
Criterion Benchmarks
O(n)
Single-Pass Scanner
01

Criterion Benchmark Suites (`benches/`)

Each subsystem has a dedicated Criterion harness so performance regressions are isolated to the exact pipeline stage:

Benchmark Target Source File Measured Operations
extractor_bench benches/extractor_bench.rs Zero-copy extract_raw_frontmatter and detect_format across YAML, TOML, and JSON payloads.
parser_bench benches/parser_bench.rs parser::parse, parse_with_options (with depth and key budgets), and to_string serialization.
meta_bench benches/meta_bench.rs meta::generate_metatags over scalar, array, Open Graph, Twitter Card, and HTML-escaped fields.
lib_bench benches/lib_bench.rs End-to-end frontmatter_gen::extract across small, medium, and large 1,000-key documents.
config_bench benches/config_bench.rs ConfigBuilder construction, validation, and serialization under the ssg feature.
error_bench benches/error_bench.rs Error and ParseError construction, line-number extraction, and Display formatting.
02

Reproducing Benchmarks Locally

Run the Criterion suites on your own hardware to generate statistical HTML reports in target/criterion/:

bash — cargo bench
# Run all 6 Criterion benchmark suites
$cargo bench --all-features
 
# Run only the zero-copy extractor or parser benchmarks
$cargo bench --bench extractor_bench
$cargo bench --bench parser_bench
03

Allocation Profile by Pipeline Stage

Because extractor::extract_raw_frontmatter only scans for opening and closing delimiters, its runtime is independent of the size of the Markdown body that follows the closing fence:

Operation Time Complexity Heap Allocations
extractor::extract_raw_frontmatter O(header_bytes) 0 allocations (borrows (&str, &str) from input)
extractor::detect_format O(header_lines) 0 allocations (inspects trimmed slices in place)
parser::parse_with_options O(header_bytes) 1 Frontmatter map + recursive Value nodes
meta::generate_metatags O(keys) 1 output String buffer with entity-escaped tags
High-throughput Rust benchmarking and zero-copy slice extraction
Sub-microsecond slice extraction: Markdown bodies of any size are returned as zero-copy borrowed slices without scanning past the closing fence.