[Lldb-commits] [PATCH] D149214: [lldb] Speed up DebugAbbrev parsing

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 26 16:03:13 PDT 2023


JDevlieghere added a comment.

In D149214#4300547 <https://reviews.llvm.org/D149214#4300547>, @bulbazord wrote:

> In D149214#4300491 <https://reviews.llvm.org/D149214#4300491>, @aprantl wrote:
>
>> Did you also measure the extra memory consumption? I would be surprised if this mattered, but we do parse a lot of DWARF DIEs...
>>
>> Generally this seems fine.
>
> I compared the memory profile before/after this change. The summary is that we consume about 50% more memory on average (283mb vs 425mb) but our total number of allocations is down by over half. This makes sense because the size of `DWARFAbbreviationDeclaration` now includes the size of 8 `DWARFAttribute`s, so when we create the `DWARFAbbreviationDeclaration` and copy it into the `DWARFAbbreviationDeclarationSet`'s vector, we're going to allocate more memory to hold each one. However, most `DWARFAbbreviationDeclaration`s probably don't use all 8 slots of the `SmallVector` on average, so maybe we could tune this number further to reduce overall memory consumptions?

I think it would be worthwhile to take something like clang and see how many abbreviations there are on average. I assume that should be relatively easy to track as a running average with a static variable. I also wonder what the performance hit would be if we went down to say 4 and have to allocate on the heap more frequently. I don't think it makes sense to use a non-power-of-2 value.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149214/new/

https://reviews.llvm.org/D149214



More information about the lldb-commits mailing list