[Lldb-commits] [PATCH] D68678: WIP: Speed up accelerator table lookups

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 8 18:19:13 PDT 2019


aprantl created this revision.
aprantl added reviewers: JDevlieghere, friss, jasonmolenda, jingham.
Herald added a subscriber: arphaman.

When debugging a large program like clang and doing "frame variable *this", the ValueObject pretty printer is doing hundreds of scoped FindTypes lookups. The ones that take longest are the ones where the DWARFDeclContext ends in something like `::Iterator` which produces many false positives that need to be filtered out *after* extracting the DIEs. This patch demonstrates a way to filter out false positives at the accerator table lookup step.

With this patch `lldb clang-10 -o "b EmitFunctionStart" -o r -o "f 2" -o "fr v *this" -b -- ...`  goes from 5.6s -> 4.83s or wall clock 6.979s -> 5.99s.
There are probably other good heuristics, too, and I should also implement this for DWARF 5 debug_names.


https://reviews.llvm.org/D68678

Files:
  lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp


Index: lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp
@@ -110,6 +110,17 @@
   const bool has_qualified_name_hash =
       m_apple_types_up->GetHeader().header_data.ContainsAtom(
           DWARFMappedHash::eAtomTypeQualNameHash);
+
+  // When searching for "std::vector<int>::const_iterator", reject any
+  // files without "vector<int>" early, since there will be many other
+  // "const_iterators".
+  if (context.GetSize() > 1 && context[1].tag == DW_TAG_class_type) {
+    DIEArray class_matches;
+    m_apple_types_up->FindByName(context[1].name, class_matches);
+    if (class_matches.empty())
+      return;
+  }
+
   const ConstString type_name(context[0].name);
   const dw_tag_t tag = context[0].tag;
   if (has_tag && has_qualified_name_hash) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68678.223968.patch
Type: text/x-patch
Size: 956 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191009/5d215851/attachment.bin>


More information about the lldb-commits mailing list