bneradt commented on PR #13643:
URL: https://github.com/apache/trafficserver/pull/13643#issuecomment-5543907206

   ## Formatter benchmark and rationale
   
   I measured the repository wrappers rather than timing the formatter binaries 
in isolation. The benchmark used an already-formatted checkout for each 
formatter, one warm-up run, then five full-tree no-change runs with the 
execution order alternated. Both tools were run through `uv tool run` on the 
same macOS host and filesystem.
   
   | Formatter | Samples | Median | Mean |
   | --- | --- | ---: | ---: |
   | Ruff 0.16.6 | 0.181s, 0.196s, 0.187s, 0.191s, 0.195s | **0.191s** | 0.190s 
|
   | YAPF 0.43.0 | 1.731s, 1.778s, 1.779s, 1.912s, 1.742s | **1.778s** | 1.788s 
|
   
   That makes the Ruff wrapper **9.3x faster** at the median, an **89.3% 
reduction** in elapsed time. This is the common pre-commit/format-target case, 
where most files are already formatted and fast feedback matters.
   
   Other advantages of the move:
   
   - **Unified tool delivery:** every entry point uses the existing `uv tool 
run` workflow, so developers and CI need neither a global formatter 
installation nor a manually maintained virtual environment. Ruff also aligns 
the formatter with the same Astral toolchain as `uv`.
   - **Reproducible output:** the wrapper pins Ruff 0.16.6, `ruff.toml` 
independently requires exactly 0.16.6, and preview formatting is disabled. A 
version change is therefore explicit and reviewable instead of silently 
restyling the tree.
   - **A much smaller style surface:** the 421-line YAPF configuration is 
replaced by a compact Ruff configuration. The important ATS choices remain 
explicit: 132-column lines, four-space indentation, vendored-code exclusion, 
and preservation of existing quote choices.
   - **Room to consolidate later:** Ruff can also provide linting and import 
sorting from the same fast binary if the community wants that in follow-up 
work. This PR intentionally enables only formatting.
   
   The benchmark was run at commit `2937cb2d78` for Ruff and upstream `master` 
at `80e89e5130` for YAPF.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to