gimli and its DwarfSections type specifically work in an eager fashion: when an instance is created it proactively reads all ELF sections. For uncompressed ELF files that should be fine, it's just a bunch of pointer juggling on the mmap'ed data. However, when sections are compressed, what ends up happening is that we eagerly decompress them. For data that is never used, e.g., .debug_loclists, this can mean a bunch of unnecessary work and, similarly, unnecessary memory usage.
Alas, I don't think it's easy to fix. We could skip sections that we know we don't use, but maintaining such a list is fragile and prone to become outdated. The cleaner approach would be to make this lazy, which would require a custom gimli reader. However, that stuff is somewhat performance sensitive on its own (example), so we'd need to see that we don't regress the general uncompressed file case.
gimliand itsDwarfSectionstype specifically work in an eager fashion: when an instance is created it proactively reads all ELF sections. For uncompressed ELF files that should be fine, it's just a bunch of pointer juggling on themmap'ed data. However, when sections are compressed, what ends up happening is that we eagerly decompress them. For data that is never used, e.g.,.debug_loclists, this can mean a bunch of unnecessary work and, similarly, unnecessary memory usage.Alas, I don't think it's easy to fix. We could skip sections that we know we don't use, but maintaining such a list is fragile and prone to become outdated. The cleaner approach would be to make this lazy, which would require a custom
gimlireader. However, that stuff is somewhat performance sensitive on its own (example), so we'd need to see that we don't regress the general uncompressed file case.