mirror of
https://github.com/astral-sh/ruff
synced 2026-01-09 15:44:22 -05:00
## Summary This PR adds a benchmarking script for the formatter, which benchmarks the Ruff formatter against Black, yapf, and autopep8. Three benchmarks are included: 1. Format everything. 2. Format everything, but use a single thread. 3. Format everything, but `--check` (don't write to disk). There's some nuance in figuring out the right combination of arguments to each command, but the _main_ nuance is to ensure that we always run the given formatter (and modify the target repo in-place) prior to benchmarking it, so that the formatters aren't disadvantaged by the existing formatting of the target repo. (E.g.: prior to benchmarking Black's preview style, we need to make sure we format the target repo with Black's preview style; otherwise, preview style appears much slower.) Part of https://github.com/astral-sh/ruff/issues/7309.