Benchmarks
Wall-clock formatting speed of arity against other R formatters, measured
with hyperfine. The default comparison is against
air;
styler can be added opt-in (see below). Every
tool formats stdin to stdout (exit 0 regardless of changes), so the comparison
is free of file-mutation and exit-code noise.
This is not a CI gate and not a parity target. Timings are machine- and
run-dependent, and these numbers measure speed only, never output equivalence
(see AIR_COMPAT.md or task air-compat for that). The tools also pay very
different startup floors: styler runs inside an R process, so a large part of
its time on small inputs is interpreter startup rather than formatting work.
Treat the ratios, not the absolute milliseconds, as the takeaway.
The figures below are regenerated manually with task bench and committed as a
machine-readable artifact (benches/benchmark_results.json); they are never
re-measured when this site is built or in CI.
How it is measured
Each tool is invoked exactly as a user would pipe a file through it, stdin to stdout:
| Tool | Invocation |
|---|---|
arity | arity format |
air | air format --stdin-file-path bench.R |
styler | Rscript -e 'styler::style_text(readLines(file("stdin")))' |
arity is the baseline; every other tool’s time is reported relative to it.
Comparison tools absent from the machine are skipped, so a run with only air
installed compares just arity and air. The timing backend prefers
hyperfine (warmup plus stddev/min/max); without hyperfine and jq it falls
back to a mean-only shell loop and the min/max columns become blank.
styler is an R package: it pays an interpreter startup floor plus a steep
per-line cost (seconds even on the small tier), so it is not measured by
default. Opt in with ARITY_BENCH_STYLER=1 task bench; even then it is skipped
on tiers too large to format in reasonable time, so it may appear for only some
tiers. Because the tools do such different work, this is a rough scale
comparison, not a like-for-like one.
Corpus
The corpus is synthetic: every tests/fixtures/formatter/*/expected.R is
concatenated (sorted, blank-line separated) into a base block, which is repeated
to two size tiers. The content repeats, so it is cache-friendly and not fully
representative of real code; it exists to amortize process startup and show
rough scaling, not to model a real workload. (Pass ARITY_BENCH_INPUT to
benchmark a single real file instead.)
Setup
- arity:
0.11.0 - air:
0.10.0 - backend: hyperfine (min runs: 3)
- host: linux/x86_64, Intel(R) Core(TM) Ultra 7 155U
- generated: 2026-07-10T00:58:49Z
Results
arity. Each dot is one corpus tier formatted by one tool; the vertical position is mean wall-clock time as a ratio to arity on a log scale, so arity lies on the dashed baseline at 1, faster tools fall below it and slower tools rise above. Color distinguishes tiers; hover a dot for the exact millisecond figures.Data table
small (123094 bytes, 8498 lines)
| Tool | Mean (ms) | Min (ms) | Max (ms) | Relative |
|---|---|---|---|---|
| arity | 25.0912 | 21.0695 | 32.0858 | baseline |
| air | 31.6320 | 28.2261 | 41.2459 | 1.3x slower |
large (1477128 bytes, 101976 lines)
| Tool | Mean (ms) | Min (ms) | Max (ms) | Relative |
|---|---|---|---|---|
| arity | 761.7270 | 713.3926 | 815.4131 | baseline |
| air | 368.2495 | 359.3317 | 393.7535 | 2.1x faster |