Skip to content

Compiler performance returning nested closures #68061

Closed

Description

@197g

The following takes approximately one year to compile:

fn main() {
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||();
}

(This estimate was derived from observing that compile time scales seemingly exponentially in the depth of the instantiated closure. At level 23 it took about 25 seconds, and at 22 only 13. Extrapolating this doubling-per-depth leads us to about a year at level 43 which is depicted above).

Activity

  1. added
    A-closuresArea: Closures (`|…| { … }`)
    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.
    on Jan 9, 2020
  2. tesuji commented on Jan 11, 2020

    @tesuji
    Contributor
  3. jonas-schievink commented on Jan 19, 2020

    @jonas-schievink
    Contributor
    fn main() {
    ||||||||||||||||||||||||||||||||||||||||||||();
    }

    Yields:

    +-----------------------------------------------+-----------+-----------------+----------+------------+------------+--------------+-----------------------+
    | Item                                          | Self time | % of total time | Time     | Item count | Cache hits | Blocked time | Incremental load time |
    +-----------------------------------------------+-----------+-----------------+----------+------------+------------+--------------+-----------------------+
    | mir_borrowck                                  | 8.64s     | 98.672          | 21.61s   | 23         | 0          | 0.00ns       | 0.00ns                |
    

    cc @matthewjasper

  4. added a commit that references this issue on Feb 3, 2020
    0d34a87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-borrow-checkerArea: The borrow checkerA-closuresArea: Closures (`|…| { … }`)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