While measuring some performance in LLDB I noticed that we were
spending a decent amount of time parsing the debug abbrev section.
There are 2 very easy ways to improve speed here:
- Move DWARFAbbreviationDeclarationSets into the the DWARFDebugAbbrev map
- Use an llvm::SmallVector instead of a std::vector for DWARFAbbreviationDeclaration's m_attributes field. These things hardly ever have more than 10-11 attributes, so SmallVector seems like a better fit.
To measure performance impact, I took a project with 10,000 c++ source
files, built objects out of them all, and linked them into one binary.
Then I loaded it into lldb, placed a breakpoint on main, and then
exited.
Without this patch, it took about 5.2 seconds on my machine. With this
patch, it took about 4.9 seconds, so this shaves off about 300ms of
time.
With this change, can the following be removed from` DWARFAttribute.h`?