[Lldb-commits] [PATCH] D149214: [lldb] Speed up DebugAbbrev parsing
Alex Langford via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Apr 25 16:12:30 PDT 2023
bulbazord created this revision.
bulbazord added reviewers: aprantl, JDevlieghere.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D149214
Files:
lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
@@ -112,7 +112,7 @@
if (error)
return error;
- m_abbrevCollMap[initial_cu_offset] = abbrevDeclSet;
+ m_abbrevCollMap[initial_cu_offset] = std::move(abbrevDeclSet);
}
m_prev_abbr_offset_pos = m_abbrevCollMap.end();
return llvm::ErrorSuccess();
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h
@@ -58,7 +58,7 @@
dw_uleb128_t m_code = InvalidCode;
dw_tag_t m_tag = llvm::dwarf::DW_TAG_null;
uint8_t m_has_children = 0;
- DWARFAttribute::collection m_attributes;
+ llvm::SmallVector<DWARFAttribute, 8> m_attributes;
};
#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFABBREVIATIONDECLARATION_H
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149214.516971.patch
Type: text/x-patch
Size: 1132 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230425/bfec02e8/attachment-0001.bin>
More information about the lldb-commits
mailing list