rustc generates a lot of LLVM IR when using a match in struct field initialization #68822
Labels
A-codegen
Area: Code generation
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
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.
In rusterlium/rustler#299, we detected compile time to increase non-linearly when using a rather simple proc-macro. In rusterlium/rustler#299 (comment), we found that our decoder function results in a lot of IR. We were able to fix the issue in rusterlium/rustler#300 by making a simple transformation for generated struct initialization.
Transformation
The change to our proc-macro resulted in the following transformation of the resulting code.
Before:
After:
Simplification
I simplified our case in https://github.com/evnu/rust-slow-compilation. I haven't been able to simplify this further: when I tried to get rid of the rustler-specific
Decoder
, or when usingmap_err()
, compilation became very fast. The README of the repository indicates compilation times on my machine for specific revisions of the repository.Meta
The text was updated successfully, but these errors were encountered: