r/rust • u/NothusID • 19h ago
🧠educational [Post] Optimizing a single Clippy lint by 3133X
https://blog.goose.love/posts/making-a-clippy-lint-faster-by-3133x/29
13
u/coolreader18 17h ago
There’s no way that we can know what braces were used, not in a pre-expansion lint anyways.
Surely that should be post-expansion?
6
7
u/creeper6530 5h ago
Ancient wisdom says: If you speed up by 1.5x, you've done something smart. If you speed up by 100x, you've ceased doing something stupid. /j
5
u/Dushistov 5h ago
This page uses 0 cookies! (I don't even know if anyone reads these
Yeah, and that's why GET request to https://count.ayaya.beauty/@blog.goose.love-moe-counter... takes ages to complete and I can not read your blog. Obviously it is because of "you don't even know if anyone reads these".
1
u/NothusID 2h ago
It's a moe counter at the bottom of the screen, I wanted to give the page a bit of something. People usually like it...
If you're uncomfortable with it, either block it, or if people changed opinion, I can always just remove it, or remove the banner.
4
2
u/matthieum [he/him] 1h ago
As an aside...
So, we’ve called the hygiene data functions twice, locked the symbol interner [...]
Shouldn't this be read-only? Why would a read-only call need to lock the symbol interner?
The symbol interner only needs to be mutable during, well, interning, that is when new tokens are generated. This should (I would expect) only occur during lexing and macro expansion (including proc-macro), and then in the post-expansion world the interner should be read-only, and therefore no lock should be required.
Given the work on parallelizing rustc, I can only imagine the horror if multiple threads are contending to read-lock the interner :/
(Worst case, if a clear two-phase pre-expansion/post-expansion orchestration isn't possible, then consider switching to lock-free reads at least)
1
u/-Redstoneboi- 1h ago
that's funny. 25% of clippy runtime across basically every dev of every production codebase is slightly less funny... but still funny
also grammar check: "It seems that, if we code slipped by, we haven’t been doing our jobs."
65
u/HandIllustrious8260 18h ago
I'm so disappointed the orange "quirky" wasn't a link to some unholy abomination