Skip to content

[debuginfo] Optimize .debug_line generation (was: Memoize line_program_add_file result) #807

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

Closed
bjorn3 opened this issue Nov 24, 2019 · 5 comments
Labels
A-debuginfo Area: Debugging information at runtime in generated code. compile-time How fast is the code compiled

Comments

@bjorn3
Copy link
Member

bjorn3 commented Nov 24, 2019

It is responsible for over half of the time spent in debuginfo generation.

@bjorn3 bjorn3 added A-debuginfo Area: Debugging information at runtime in generated code. compile-time How fast is the code compiled labels Nov 24, 2019
@bjorn3
Copy link
Member Author

bjorn3 commented Dec 16, 2019

Optimized line_program_add_file a bit in bjorn3@3e50a83.

@bjorn3 bjorn3 changed the title [debuginfo] Memoize line_program_add_file result [debuginfo] Optimize .debug_line generation (was: Memoize line_program_add_file result) Dec 16, 2019
@bjorn3
Copy link
Member Author

bjorn3 commented Dec 16, 2019

https://github.com/bjorn3/rustc_codegen_cranelift/blob/3e50a831e59ee56d63fe72f350759e4ba6099bf8/src/debuginfo/line_info.rs#L77

lookup_char_pos converts BytePos into a CharPos, which is a costly operation, as it loops for every non ascii character before the current position, of which there can be a lot when libcore and libstd are loaded.

Edit: created https://zulip-archive.rust-lang.org/187780tcompilerwgllvm/51206DWARFdebuglinecolumnandutf8.html to find out if it is allowed by DWARF to change to BytePos.

@bjorn3 bjorn3 closed this as completed in 29fafb4 Jan 14, 2020
@bjorn3
Copy link
Member Author

bjorn3 commented Jan 14, 2020

Re-opening as there are still possible improvements. For example gimli-rs/gimli#468.

@bjorn3 bjorn3 reopened this Jan 14, 2020
@bjorn3
Copy link
Member Author

bjorn3 commented Feb 3, 2020

eb4fc45 improved the speed of the span -> (file, line, col) mapping.

Edit: reverted in fbe36ad, because it caused a panic.

@bjorn3
Copy link
Member Author

bjorn3 commented Mar 14, 2020

I should have said in the commit message that the time FunctionDebugContext::define now takes ~40% of the time it used to take.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information at runtime in generated code. compile-time How fast is the code compiled
Projects
None yet
Development

No branches or pull requests

1 participant