Skip to content

Excessive drop glue duplication in vtables can blow up compile times #88438

Open
@jonas-schievink

Description

@jonas-schievink

Currently, it seems like every CGU that contains a &ConcreteType -> &dyn Trait cast will instantiate the corresponding vtable and drop glue of ConcreteType. This can result in massive LLVM IR bloat that then slows down compile times.

We have observed this in rust-analyzer (rust-lang/rust-analyzer#10065, also Zulip discussion here), where the drop glue of a single type RootDatabase is responsible for over 40% of LLVM IR in some downstream crates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationA-destructorsArea: Destructors (`Drop`, …)C-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchI-compiletimeIssue: Problems and improvements with respect to compile times.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions