Expand description
Deterministic synthetic corpora for benchmarking.
Every benchmark that needed pages used to generate them inline, so the
numbers were only comparable within a single bench file: bench_scalability
and incremental_1000_pages wrote different front matter and different body
lengths, then reported timings as though they measured the same work. A
published figure has to be reproducible by whoever reads it, which means one
generator, one shape, and no hidden inputs.
§Determinism
Content is derived from a seed and the page index through a small
xorshift generator rather than the rand crate: the corpus must be
byte-identical across machines, architectures and toolchain versions, and
rand’s output is explicitly not stable across releases. The same seed
therefore yields the same corpus in a year’s time, which is the property
that lets a benchmark number be checked rather than believed.
Body length and tag selection vary per page — a corpus of identical pages measures the cache, not the compiler — but vary predictably.
§Examples
use ssg::bench_corpus::{generate_corpus, CorpusSpec};
let dir = tempfile::tempdir().unwrap();
let spec = CorpusSpec::new(64);
let written = generate_corpus(dir.path(), &spec).unwrap();
assert_eq!(written, 64);Structs§
- Corpus
Spec - Shape of a synthetic corpus.
Functions§
- generate_
corpus - Writes
spec.pagesMarkdown files intodir, returning the count written.