Skip to content

Large amounts of repeated data in debug info #129722

Open
@khuey

Description

@khuey

In #128861 (comment) I teased @nnethercote with the promise of more debug info inefficiency. One example is that the .debug_ranges section that specifies the ranges over which DWARF constructs such as functions, variables, etc are valid contains large amounts of repeated data. Rust's love of inlining and zero cost abstractions tends to produce repeated ranges.

When built with debuginfo-level = 2, tip Rust's librustc_driver.so has approximately 2.1 million entries in .debug_ranges. There are only approximately 1.1 million unique entries though. Doing the dumbest possible thing in LLVM (checking in DwarfFile::add_range to see if the new range is exactly equal to the last range, and not adding a new entry if it is) eliminates virtually all duplicated ranges (less than 1k remain) and results in a 43% reduction in the size of the .debug_ranges section, or a roughly 1.75% reduction in the size of the .so

@rustbot label A-debuginfo A-llvm I-heavy

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-bugCategory: This is a bug.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCI-heavyIssue: Problems and improvements with respect to binary size of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions