Benchmarks

Yamark performance against other YAML and Markdown formatters.

On the benchmark host (Apple M4 Max, macOS arm64), Yamark recorded the lowest elapsed time in all four workloads: 79–89 ms for each generated 4 MB file and 133 ms for 500 generated YAML files (50 MB).

Each table compares the formatter CLIs in this harness that accept that input. Tools use their default formatting behavior, with no formatting options, shims, or adapters, so the roster differs by input kind.

At a glance

The next-lowest result is the lowest median wall time among the other CLIs for that workload. Relative time shows that result as a multiple of Yamark’s time. The output note keeps differences in default formatting behavior beside the timing.

Yamark and the next-lowest elapsed time in each workload
Workload Yamark Next-lowest elapsed Relative time Output note
4 MB Markdown 89 ms dprint · 327 ms 3.7× Both rewrite Markdown
4 MB YAML 79 ms yamlfmt · 184 ms 2.3× Both rewrite YAML
4 MB Markdown + 200 KB YAML front matter 89 ms dprint · 317 ms 3.6× dprint leaves YAML front matter untouched
500 YAML files (50 MB) 133 ms dprint · 2.6 s 19.5× Both rewrite all 500 files

Elapsed time by formatter

Median wall time; lower is better. All four panels share a logarithmic seconds scale.

Exact values:

  • 4 MB Markdown - Yamark: 89 ms
  • 4 MB Markdown - dprint: 327 ms
  • 4 MB Markdown - Panache: 398 ms
  • 4 MB Markdown - Deno: 407 ms
  • 4 MB Markdown - Prettier: 1.5 s
  • 4 MB Markdown - mdformat: 2.8 s
  • 4 MB YAML - Yamark: 79 ms
  • 4 MB YAML - yamlfmt: 184 ms
  • 4 MB YAML - Deno: 800 ms
  • 4 MB YAML - dprint: 1.0 s
  • 4 MB YAML - yamlfix: 7.1 s
  • 4 MB YAML - Prettier: 18.7 s (file unchanged)
  • 4 MB Markdown + front matter - Yamark: 89 ms (formatted)
  • 4 MB Markdown + front matter - dprint: 317 ms (untouched)
  • 4 MB Markdown + front matter - Deno: 446 ms (formatted)
  • 4 MB Markdown + front matter - Prettier: 1.6 s (formatted)
  • 4 MB Markdown + front matter - mdformat: 3.2 s (not preserved)
  • 4 MB Markdown + front matter - Panache: 6.8 s (formatted)
  • 500 YAML files · 50 MB - Yamark: 133 ms
  • 500 YAML files · 50 MB - dprint: 2.6 s
  • 500 YAML files · 50 MB - Deno: 3.2 s
  • 500 YAML files · 50 MB - yamlfmt: 3.6 s
  • 500 YAML files · 50 MB - Prettier: 41.6 s
  • 500 YAML files · 50 MB - yamlfix: 175.6 s

Detailed results

One generated 4 MB Markdown document (big.md): prose paragraphs, links, and nested lists. Each tool’s CLI formats a fresh copy. Wall time includes process startup and is the median of 20 measured runs after 2 warmup runs. Peak RSS is the median across measured runs.

Formatter Wall time Peak RSS
yamark 89 ms 20.9 MB
dprint-markdown 327 ms 172.6 MB
panache 398 ms 31.8 MB
deno-fmt 407 ms 478.4 MB
prettier 1.5 s 522.7 MB
mdformat 2.8 s 135.2 MB

One generated 4 MB YAML file (big.yaml): block maps and sequences, block scalars, and comments. Same procedure as the Markdown comparison.

Formatter Wall time Peak RSS
yamark 79 ms 53.1 MB
yamlfmt 184 ms 295.0 MB
deno-fmt 800 ms 138.1 MB
dprint-yaml 1.0 s 118.6 MB
yamlfix 7.1 s 271.8 MB
prettier 18.7 s 1057.8 MB

The same 4 MB document shape (big-with-frontmatter.md) with a 200 KB deliberately unformatted YAML front matter block - about a third of the document’s lines are YAML. The Front matter column reports what each tool did with that block: formatted (rewrote it), untouched (passed it through), or not preserved (broke the delimiters).

Formatter Wall time Peak RSS Front matter
yamark 89 ms 22.6 MB formatted
dprint-markdown 317 ms 172.8 MB untouched
deno-fmt 446 ms 583.4 MB formatted
prettier 1.6 s 546.2 MB formatted
mdformat 3.2 s 132.4 MB not preserved
panache 6.8 s 40.6 MB formatted

The harness derives that column from the output bytes: trailing-whitespace trimming does not count as formatting. dprint’s Markdown plugin passes front matter through unformatted. mdformat, installed without its front-matter plugin, reads the opening --- as a thematic break and does not preserve the front matter delimiters.

500 generated YAML service-configuration files of about 100 KB each (50 MB in total). Each tool receives the directory root once and discovers the files itself. Every run uses a fresh copy and is verified to reformat all 500 files. Wall time is the median of 7 measured runs after 1 warmup run.

Formatter Wall time User CPU time
yamark 0.133 s 1.219 s
dprint-yaml 2.591 s 37.139 s
deno-fmt 3.233 s 46.809 s
yamlfmt 3.570 s 4.011 s
prettier 41.608 s 61.247 s
yamlfix 175.650 s 175.384 s

Yamark formats the directory in parallel, as do deno-fmt and dprint, so total user CPU time can exceed wall time. User CPU time is summed across threads and processes and excludes system CPU time.

Methodology

The benchmark scripts (tools/bench/big.py and tools/bench/run.py) generate the corpora deterministically and run each included tool through its own CLI. Across the four workloads, Yamark is compared with deno-fmt, dprint-markdown, dprint-yaml, mdformat, panache, prettier, yamlfix, yamlfmt.

Two details keep cached work out of the timings and limit dprint’s configuration to plugin selection:

  • panache and dprint cache formatting results. The harness stores their caches in the benchmark work directory and clears cached formatting results between repetitions, so each timed run formats from scratch.
  • dprint has no built-in plugins, so it runs with a config file that names the first-party plugin for the input kind and sets no formatting options.

Autofixing linters (pymarkdown, markdownlint-cli2) are outside this formatter-CLI comparison. The harness can still run them with --tools.

Wall time can vary with system load and scheduling, especially for the parallel directory workload.

Measured on a MacBook Pro (Apple M4 Max, macOS arm64) using Yamark 0.3.0+dev, built from commit 240432ea9f68 with cargo build --release --locked. Tool versions: yamark 0.3.0+dev, dprint 0.57.4, deno 2.9.7 (stable, release, aarch64-apple-darwin), yamlfmt 0.21.0 (Homebrew), prettier 3.8.3, yamlfix 1.19.1, panache 2.46.0, mdformat 1.0.0.

The tables use the latest complete checked-in single-file results and directory results. The artifacts record the full per-run timings, output hashes, git commit, and host details. A table renders only when every tool in its roster completes the benchmark.

Reproducing

tools/bench/big.py --reps 20 --warmups 2
tools/bench/run.py --invocation directory --files 500 --items 540 \
  --reps 7 --warmups 1 \
  --tools yamark,yamlfmt,prettier,yamlfix,dprint-yaml,deno-fmt

The corpora are generated deterministically, so the same commands reproduce the same inputs anywhere; each script writes a JSON artifact under docs/benchmarks/.

Run tools/bench/run-all.py for the complete suite using one frozen release binary. It saves the artifacts, logs, retained corpora, and a manifest under target/bench-all/.