Skip to content

Extremely slow macro expansion #43704

Closed
Closed
@mikebenfield

Description

@mikebenfield

See this gist.

Here is a chart giving real time output from time rustc main.rs -o out with n of the lines of the form [0xDD, 0xCB, d, 0x00 ] uncommented.

n sec
100 0.561
200 1.457
300 3.042
400 5.474
500 8.061
600 12.364
700 17.520
800 25.105
900 37.410
1000 48.006
1100 72.33

With this gist I've tried to create a fairly minimal example. It's not as minimal as maybe it could be because it's a little tricky to figure out what's causing the slow compiles and I've spent as much time as I can on this right now. It's very sensitive to seemingly irrelevant changes in the code. If I remove the unused count variable, compile times dramatically improve. If I remove the empty for loop, compile times dramatically improve.

On my actual project, I am getting compile times in excess of 20 minutes. To compile a few thousand lines of code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-compilememIssue: Problems and improvements with respect to memory usage during compilation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions