Skip to content

Methods take an insanely long time to compile #40280

Closed
@tomaka

Description

@tomaka

This commit takes an insane amount of time to compile. Before the commit, the crate takes about 15 seconds to compile. After the commit, I stopped after around 15 minutes. EDIT: estimates would be about 2 hours.

I've isolated the problem to this code. These are two methods implemented on tuples. They should expand to roughly something like this:

let &(first, B, C, D, E, F, G, H) = self;
let iter = first.buffers_list();
let iter = iter.chain(B.buffers_list());
let iter = iter.chain(C.buffers_list());
let iter = iter.chain(D.buffers_list());
let iter = iter.chain(E.buffers_list());
let iter = iter.chain(F.buffers_list());
let iter = iter.chain(G.buffers_list());
let iter = iter.chain(H.buffers_list());
Box::new(iter)

If I reduce the maximum size of the tuple here to only 16 elements, the item-bodies checking pass takes about 11 seconds. With 17 elements, it takes about 18 seconds. With 18 elements, it takes about 33 seconds. With 19 elements, about 60 seconds.

cc @eddyb

Metadata

Metadata

Assignees

No one assigned

    Labels

    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