-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize the
#[must_use]
lint queries by improving filtering. (#286)
Most items are not `#[must_use]`. By moving the more-selective branch of the query (the `current` one that looks for `#[must_use]`), the query will evaluate fewer items because it will discard more of them earlier in the process. The speedup is approximately a factor of 1600-2000x when measured on a particularly large crate: `aws-sdk-ec2` /~https://github.com/awslabs/aws-sdk-rust/tree/main/sdk/ec2 Running just the 4 affected lints on that crate: - Before: 401-413s total scan time - After: 0.21-0.25s total scan time The numbers only include lint execution time, excluding things such as the time needed to build the rustdoc JSON. This is an optimization that requires knowing the underlying shape of the dataset being queried, so it's not something that Trustfall could have applied automatically without access to statistics.
- Loading branch information
1 parent
06026c5
commit cf1e270
Showing
4 changed files
with
48 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters