Skip to content

Compilation time blows up with huge, numerous and nested enums #42747

Closed
@hadronized

Description

@hadronized

I’m building a GLSL parser and hence have a very specific need for numerous, deeply nested enums. I added all the grammar symbols / tokens, and now the compilation takes more 20 minutes on my rustc 1.19.0-nightly (78d8416 2017-06-17), Mac OSX. The compilation passes point at the item-types checking pass – it takes roughly 5 minutes here – as being the bottleneck. The code can be found here.

Important note: I think that the problem is linked to all the numerous recursive enums. I guess rustc struggles to identify the size or whatever about the enums because it tries to see whether recursions are terminal? Thing is: I tried to box almost all variants, and the result is there: I reduced the compilation time from 20 minutes to a few seconds.

Extra note: you can take the module linked above and compile it directly with rustc, no need to depend on the whole phaazon/glsl project ;)

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-compiletimeIssue: Problems and improvements with respect to compile times.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions