about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2025-06-13 06:09:14 +0000
committerGitHub <noreply@github.com>2025-06-13 06:09:14 +0000
commit6662aedb86fa3a50f18dba4e9fa3bd21beb377bd (patch)
tree719bf9d228520efcc43012519149bfe8d055274c /compiler/rustc_codegen_llvm/src
parent59d8345852dd012dd0fe67f2feb05313418d6925 (diff)
parent6cd55b966f75aeb94b3f2cd17b806f0330c009fb (diff)
downloadrust-6662aedb86fa3a50f18dba4e9fa3bd21beb377bd.tar.gz
rust-6662aedb86fa3a50f18dba4e9fa3bd21beb377bd.zip
[PERF] Optimize 3rd heaviest func, (81b -> 10m) (#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. :tada: :partying_face:

changelog: [`strlen_on_c_strings`]: Optimize it by 99.75%
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions