Skip to content

MIR building for match $c { true => $i, _ => $e } is slow #60571

Closed
@Centril

Description

@Centril

At the time of writing, if $c { $i } else { $e } builds MIR that is simpler and therefore is ~1-3% better in terms of compile times than match $c { $i } else { $e }. However, after the early-opt MIR optimization, they are basically the same.

In #59288 we start desugaring if expressions to match and so if we optimize for the special case of two match arms we can potentially improve compiles times.

cc @oli-obk

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-enhancementCategory: An issue proposing an enhancement or a PR with one.F-let_chains`#![feature(let_chains)]`I-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