Skip to content

Performance regression in 1.72 related to normalization of opaques with late-bound vars #115283

Open
@kornelski

Description

@kornelski

Upgrade from 1.71 to 1.72 has made compilation time of my async-heavy actix server 350 times slower (from under 5s to 30 minutes, on a 32GB M1 Max CPU).

I've bisected it to commit a20a04e (#113108).

The slowdown is still in the latest nightly (1.74.0 69e97df 2023-08-26). 1.72 and the nightly spend 30% of all compilation time in Interners::intern_ty, mainly called by <rustc_middle[b15c2eca62e7285b]::ty::Ty as rustc_type_ir[f43ddb3fb00a443c]::fold::TypeSuperFoldable<rustc_middle[b15c2eca62e7285b]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_middle[b15c2eca62e7285b]::ty::generic_args::ArgFolder> and <rustc_middle[b15c2eca62e7285b]::ty::Ty as rustc_type_ir[f43ddb3fb00a443c]::fold::TypeSuperFoldable<rustc_middle[b15c2eca62e7285b]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_trait_selection[961e83e42176765a]::traits::project::AssocTypeNormalizer>.

The reduced code is in: https://gitlab.com/lib.rs/main/-/commits/reproducer

outdated info Apologies for a big spaghetti reproducer. Let me know if it'd be useful to reduce it.
git clone --recursive https://gitlab.com/lib.rs/main
cd main
git reset --hard 81c612b
cargo build -p crates-server

I suspect the culprit is this function, which is used in several places in server/src/main.rs:

async fn with_file_cache<F: Send>(state: &AServerState, cache_file_name: &str, cache_time: u32, allow_stale: bool, generate: F) -> Result<Rendered, anyhow::Error>
    where F: Future<Output=Result<Rendered, anyhow::Error>> + 'static {

@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-compiletimeIssue: Problems and improvements with respect to compile times.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-compiler-performanceWorking group: Compiler Performanceregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions