Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler performance returning nested closures #68061

Closed
HeroicKatora opened this issue Jan 9, 2020 · 2 comments · Fixed by #68772
Closed

Compiler performance returning nested closures #68061

HeroicKatora opened this issue Jan 9, 2020 · 2 comments · Fixed by #68772
Labels
A-borrow-checker Area: The borrow checker A-closures Area: closures (`|args| { .. }`) I-compiletime Issue: Problems and improvements with respect to compile times. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@HeroicKatora
Copy link
Contributor

HeroicKatora commented Jan 9, 2020

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).

@jonas-schievink jonas-schievink added A-closures Area: closures (`|args| { .. }`) I-compiletime Issue: Problems and improvements with respect to compile times. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 9, 2020
@tesuji
Copy link
Contributor

tesuji commented Jan 11, 2020

@jonas-schievink jonas-schievink added the A-borrow-checker Area: The borrow checker label Jan 19, 2020
@jonas-schievink
Copy link
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-borrow-checker Area: The borrow checker A-closures Area: closures (`|args| { .. }`) I-compiletime Issue: Problems and improvements with respect to compile times. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants