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

Code generation issue blocks the removal of an unused struct field #77058

Closed
vandenheuvel opened this issue Sep 22, 2020 · 0 comments · Fixed by #77257
Closed

Code generation issue blocks the removal of an unused struct field #77058

vandenheuvel opened this issue Sep 22, 2020 · 0 comments · Fixed by #77257
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. I-compiletime Issue: Problems and improvements with respect to compile times.

Comments

@vandenheuvel
Copy link
Contributor

vandenheuvel commented Sep 22, 2020

The unused_field field of type Option<DefId> in ParamEnv is not used but removing the field has a strange and undesired effect on compiler performance.

When the field is removed, performance changes as in #74865 are observed: an instruction count gain of about 1% across all tests, with the unicode_* tests demonstrating a 3% increase, even though, in principle, less work should be done if the unused field is not copied around. Worse, the 3% instruction count increase corresponds to a 25% percent increase in wall-time, moreover suggesting that something is going wrong.

Interestingly, changing the type of Option<DefId>, which is 8 bytes long, with an unused field of type [u8; 8], has a performance impact. The conversation at #76913 contains several perf runs that are relevant.

Once the code generation issue is resolved and the field is removed, a performance gain of about 1% is expected to be realized.

@vandenheuvel vandenheuvel added the C-bug Category: This is a bug. label Sep 22, 2020
@jyn514 jyn514 added I-compiletime Issue: Problems and improvements with respect to compile times. A-codegen Area: Code generation labels Sep 22, 2020
@bors bors closed this as completed in 48cab67 Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation C-bug Category: This is a bug. I-compiletime Issue: Problems and improvements with respect to compile times.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants