Commit 6662aed
authored
[PERF] Optimize 3rd heaviest func, (81b -> 10m) (rust-lang#15043)
So this is funny, the query `tcx.module_children` was top 3 in most
time consuming functions in Clippy, it was being called 24384 times in
tokio. "Unacceptable!" I thought. Digging a bit around, turns out that
`clippy::strlen_on_c_strings` was calling for `get_def_path` via
`match_libc_symbol`. This query pretty-prints things and performs some
analysis.
Yes, we were running early lint checks to see if symbols were from
`libc`.
I don't really trust callgrind when it says I've turn 81 billion
instructions
into like 10 million. So I benchmarked this the good ol' "compiling 20
times
without incr" method and it went from 0.31s-0.45s to 0.25s
constistently.
(Profiled, and "benchmarked") on tokio.
What I can get behind is via `strlen_on_c_strings` changing from 31
million instructions into 76k. 🎉 🥳
changelog: [`strlen_on_c_strings`]: Optimize it by 99.75%1 file changed
+1
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1793 | 1793 | | |
1794 | 1794 | | |
1795 | 1795 | | |
1796 | | - | |
1797 | 1796 | | |
1798 | 1797 | | |
1799 | | - | |
| 1798 | + | |
1800 | 1799 | | |
1801 | 1800 | | |
1802 | 1801 | | |
| |||
0 commit comments