|
| 1 | +# Optimizing Clippy & linting |
| 2 | +(a.k.a The Clippy Performance Project) |
| 3 | + |
| 4 | +| Metadata | | |
| 5 | +| --- | --- | |
| 6 | +| Owner(s) | @blyxyas | |
| 7 | +| Teams | [clippy] | |
| 8 | +| Status | TBD, Extension | |
| 9 | +| Tracking issue | [rust-lang/rust-project-goals#114] | |
| 10 | + |
| 11 | +## Summary |
| 12 | + |
| 13 | +This is the formalization and documentation of the Clippy Performance Project, a project first talked about on [Zulip, July 2023](https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Clippy's.20performance). As the project consists of several points and is ever-changing, this document also has a dynamic structure and the team can add points. |
| 14 | + |
| 15 | +In short, this is an effort to optimize Clippy, and Rust's linting infrastructure with a point of view of making Clippy faster (both on CI/CD pipelines, and on devs' machines) |
| 16 | + |
| 17 | +## Motivation |
| 18 | + |
| 19 | +Clippy can take up to 2.5 times the time that a normal `cargo check` takes, and it doesn't need to be! Taking so long is expensive both in development time, and in real money. |
| 20 | + |
| 21 | +### The status quo |
| 22 | + |
| 23 | +Based on some [informal][poll-urlo] [feedback][poll-reddit] [polls][poll-mastodon], it's clear that Clippy is used in lots of different contexts. Both in developer's IDEs and outside them. |
| 24 | + |
| 25 | +The usage for IDEs is not as smooth as one may desire or expect when comparing to prior art like [Prettier][prettier], [Ruff][ruff], or other tools in the Rust ecosystem `rustfmt` and Rust-analyzer. |
| 26 | + |
| 27 | +The other big use-case is as a test before committing or on CI. Optimizing Clippy for performance would fold the cost of these tests. |
| 28 | + |
| 29 | +On GitHub Actions, this excessive time can equal the cost of running `cargo check` on a Linux x64 32-cores machine, instead of a Linux x64 2-cores machine. A 3.3x cost increase. |
| 30 | + |
| 31 | + |
| 32 | +<!-- *Elaborate in more detail about the problem you are trying to solve. This section is making the case for why this particular problem is worth prioritizing with project bandwidth. A strong status quo section will (a) identify the target audience and (b) give specifics about the problems they are facing today. Sometimes it may be useful to start sketching out how you think those problems will be addressed by your change, as well, though it's not necessary.* --> |
| 33 | + |
| 34 | +### The next 6 months |
| 35 | + |
| 36 | +In order to achieve a better performance we want to: |
| 37 | + |
| 38 | +- Have benchmarking software ready to run on the server. |
| 39 | +- Optimize the collection of Minimum Safe Rust Version (MSRVs) |
| 40 | +- Migrate applicable lints to use incremental compilation |
| 41 | + |
| 42 | +Apart from these 3 clear goals, any open issue, open PR or merged PRs with the label [`performance-project`](https://github.com/rust-lang/rust-clippy/issues?q=sort%3Aupdated-desc+is%3Aopen+label%3Aperformance-project) are a great benefit. |
| 43 | + |
| 44 | +### The "shiny future" we are working towards |
| 45 | + |
| 46 | +The possible outcome would be a system that can be run on-save without being a hassle to the developer, and that has the minimum possible overhead over `cargo check` (which, would also be optimized as a side of a lot of a subset of the optimizations). |
| 47 | + |
| 48 | +A developer shouldn't have to get a high-end machine to run a compiler swiftly; and a server should not spend more valuable seconds on linting than strictly necessary. |
| 49 | + |
| 50 | +[da]: ../about/design_axioms.md |
| 51 | + |
| 52 | +## Ownership and team asks |
| 53 | + |
| 54 | +**Owner:** @blyxyas |
| 55 | + |
| 56 | +| Subgoal | Owner(s) or team(s) | Notes | |
| 57 | +| ------------------ | -------------------- | ----- | |
| 58 | +| Optimization work | | | |
| 59 | +| ↳ Implementation | @blyxyas, @Alexendoo | | |
| 60 | +| ↳ Standard reviews | ![Team][] [clippy] | | |
| 61 | + |
| 62 | + |
| 63 | +[pr125116]: https://github.com/rust-lang/rust/pull/125116 |
| 64 | +[poll-urlo]: https://users.rust-lang.org/t/feedback-poll-where-and-how-do-you-use-clippy/114047?u=blyxyas |
| 65 | +[poll-reddit]: https://www.reddit.com/r/rust/comments/1dxu43p/feedback_poll_where_how_do_you_use_clippy/ |
| 66 | +[poll-mastodon]: https://tech.lgbt/@blyxyas/112747808297589676 |
| 67 | +[prettier]: https://github.com/prettier/prettier |
| 68 | +[ruff]: https://github.com/astral-sh/ruff |
0 commit comments