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: 78–117 ms for each generated 4 MB file and 181 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 117 ms dprint · 378 ms 3.2× Both rewrite Markdown
4 MB YAML 78 ms yamlfmt · 196 ms 2.5× Both rewrite YAML
4 MB Markdown + 200 KB YAML front matter 111 ms dprint · 345 ms 3.1× dprint leaves YAML front matter untouched
500 YAML files (50 MB) 181 ms Deno · 2.5 s 13.7× 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: 117 ms
  • 4 MB Markdown - dprint: 378 ms
  • 4 MB Markdown - Deno: 412 ms
  • 4 MB Markdown - Panache: 417 ms
  • 4 MB Markdown - Prettier: 1.9 s
  • 4 MB Markdown - mdformat: 3.4 s
  • 4 MB YAML - Yamark: 78 ms
  • 4 MB YAML - yamlfmt: 196 ms
  • 4 MB YAML - Deno: 766 ms
  • 4 MB YAML - dprint: 1.2 s
  • 4 MB YAML - yamlfix: 7.6 s
  • 4 MB YAML - Prettier: 20.6 s (file unchanged)
  • 4 MB Markdown + front matter - Yamark: 111 ms (formatted)
  • 4 MB Markdown + front matter - dprint: 345 ms (untouched)
  • 4 MB Markdown + front matter - Deno: 420 ms (formatted)
  • 4 MB Markdown + front matter - Prettier: 1.9 s (formatted)
  • 4 MB Markdown + front matter - mdformat: 3.8 s (not preserved)
  • 4 MB Markdown + front matter - Panache: 6.5 s (formatted)
  • 500 YAML files · 50 MB - Yamark: 181 ms
  • 500 YAML files · 50 MB - Deno: 2.5 s
  • 500 YAML files · 50 MB - dprint: 3.0 s
  • 500 YAML files · 50 MB - yamlfmt: 4.0 s
  • 500 YAML files · 50 MB - Prettier: 45.0 s
  • 500 YAML files · 50 MB - yamlfix: 176.3 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 10 measured runs after 2 warmup runs. Peak RSS is the median across measured runs.

Formatter Wall time Peak RSS
yamark 117 ms 12.7 MB
dprint-markdown 378 ms 172.8 MB
deno-fmt 412 ms 482.7 MB
panache 417 ms 32.2 MB
prettier 1.9 s 596.2 MB
mdformat 3.4 s 152.5 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 78 ms 51.7 MB
yamlfmt 196 ms 302.8 MB
deno-fmt 766 ms 142.0 MB
dprint-yaml 1.2 s 118.7 MB
yamlfix 7.6 s 269.9 MB
prettier 20.6 s 1024.3 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 111 ms 15.2 MB formatted
dprint-markdown 345 ms 173.0 MB untouched
deno-fmt 420 ms 585.3 MB formatted
prettier 1.9 s 585.7 MB formatted
mdformat 3.8 s 180.1 MB not preserved
panache 6.5 s 40.9 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 3 measured runs after 1 warmup run.

Formatter Wall time User CPU time
yamark 0.181 s 1.226 s
deno-fmt 2.478 s 33.541 s
dprint-yaml 2.958 s 39.450 s
yamlfmt 4.032 s 4.431 s
prettier 44.953 s 67.189 s
yamlfix 176.271 s 175.446 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.

Measured on a MacBook Pro (Apple M4 Max, macOS arm64) using the published PyPI release Yamark 0.3.0, built from commit 2518d01011b3. Tool versions: yamark 0.3.0, deno 2.9.5 (stable, release, aarch64-apple-darwin), dprint 0.55.2, 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
tools/bench/run.py --invocation directory --files 500 --items 540 \
  --reps 3 --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/.