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

Enabling debug symbols negatively affects the optimiser #49227

Closed
swiftcoder opened this issue Mar 21, 2018 · 5 comments
Closed

Enabling debug symbols negatively affects the optimiser #49227

swiftcoder opened this issue Mar 21, 2018 · 5 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-enhancement Category: An issue proposing an enhancement or a PR with one. I-slow Issue: Problems and improvements with respect to performance of generated code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@swiftcoder
Copy link

I have a crate of moderate complexity, which I have recently been profiling.

When I enable debug = true in conjunction with opt-level = 3, and lto = true, I'm noticing a reduction in performance of the compiled code versus just opt-level = 3, and lto = true. The builds with debug info are exhibiting highly accurate debug symbols even for small functions which I would expect to have been inlined.

I'm curious whether this behaviour is by design, and if so, why we are in the opposite camp to C++ compilers, which in my experience prioritise optimisations over accuracy of debug symbols?

@pietroalbini pietroalbini added I-slow Issue: Problems and improvements with respect to performance of generated code. A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 21, 2018
@jonas-schievink
Copy link
Contributor

This might be because frame pointers are force-enabled when debug info is requested: #48785

@michaelwoerister
Copy link
Member

That's the first time I've heard debuginfo of optimized builds being described as highly accurate :)
As @jonas-schievink mentions it might have to do with frame-pointer emission (which will soon be decoupled of debuginfo). Otherwise, this is mostly up to LLVM and I guess the situation is very similar to what clang does.

There is also debug = 1, which just generates line-tables and thus should have less of an impact on the optimizer.

@swiftcoder
Copy link
Author

There is also debug = 1, which just generates line-tables and thus should have less of an impact on the optimizer.

Ah ha. That's good to know. The Cargo manifest documentation mentions in passing that the debug entry can takes the values 2, true, and false, but I didn't pull on that thread sufficiently to realise that 1 was also a valid value.

@HadrienG2
Copy link

Now that #48785 is closed, does this problem still occur?

@jonas-schievink
Copy link
Contributor

Closing as fixed. Please let us know if this is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-enhancement Category: An issue proposing an enhancement or a PR with one. I-slow Issue: Problems and improvements with respect to performance of generated code. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants