Skip to content

[Perf] Where are the LLVM symbols coming from? #14423

Open
@blyxyas

Description

@blyxyas

When profiling Clippy either with Valgrind or with cargo lintcheck --perf, we can see that Clippy does a lot of use out of LLVM symbols. We need to investigate why is that the case and how can we remediate it.

Using Valgrind (specifically Callgrind), turns out that we are spending a lot of resources on LLVM symbols that cargo check does not spend resources on.

Where are the LLVM calls coming from? I have some theories.

  1. We are using a query/function that triggers codegen.
  2. Clippy does not actually deactivate codegen (weird)
  3. #![feature(rustc_private)] for importing rustc_hir and such automatically imports LLVM and performs some internal LLVM function.

callgrind output showing a lot of calls to libLLVM.so.20.1-rust-1.87.0-nightly, notably llvm::cl::Option::addArgument

Some time ago I talked about why does Clippy have so many relocations, and how it could be caused by the dynamic linking. Since then I've had a chat with someone that mentioned that LLVM compilation suffers from a lot of relocations, and how that could be the reason.

Metadata

Metadata

Assignees

No one assigned

    Labels

    performance-projectFor issues and PRs related to the Clippy Performance Project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions