mirror of https://github.com/astral-sh/ruff
## Summary Related to https://github.com/astral-sh/ruff/issues/8135. If we're not printing a `--diff`, or a summary of `--check` changes, we can avoid sorting the list of results. Further, when sorting, we only need to sort a small subset of the entries, in the common case (i.e., in general, it's much more likely that a file is formatted than not). ## Test Plan Local benchmarks suggest a 5-10% speedup on the cached behavior: ``` ❯ hyperfine --warmup 3 "./target/release/ruff format ../airflow" "./target/release/sort format ../airflow" Benchmark 1: ./target/release/ruff format ../airflow Time (mean ± σ): 70.3 ms ± 5.2 ms [User: 52.1 ms, System: 59.0 ms] Range (min … max): 68.3 ms … 101.7 ms 42 runs Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet PC without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options. Benchmark 2: ./target/release/sort format ../airflow Time (mean ± σ): 66.0 ms ± 1.4 ms [User: 48.3 ms, System: 58.4 ms] Range (min … max): 64.7 ms … 71.8 ms 44 runs Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet PC without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options. Summary './target/release/sort format ../airflow' ran 1.07 ± 0.08 times faster than './target/release/ruff format ../airflow' ``` |
||
|---|---|---|
| .. | ||
| flake8_to_ruff | ||
| ruff_benchmark | ||
| ruff_cache | ||
| ruff_cli | ||
| ruff_dev | ||
| ruff_diagnostics | ||
| ruff_formatter | ||
| ruff_index | ||
| ruff_linter | ||
| ruff_macros | ||
| ruff_notebook | ||
| ruff_python_ast | ||
| ruff_python_codegen | ||
| ruff_python_formatter | ||
| ruff_python_index | ||
| ruff_python_literal | ||
| ruff_python_parser | ||
| ruff_python_resolver | ||
| ruff_python_semantic | ||
| ruff_python_stdlib | ||
| ruff_python_trivia | ||
| ruff_shrinking | ||
| ruff_source_file | ||
| ruff_text_size | ||
| ruff_wasm | ||
| ruff_workspace | ||