[Lldb-commits] [PATCH] D68549: make ConstString allocate memory in non-tiny chunks

Luboš Luňák via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Oct 5 19:47:07 PDT 2019


llunak created this revision.
llunak added a reviewer: clayborg.
llunak added a project: LLDB.
Herald added subscribers: lldb-commits, JDevlieghere, aprantl.

BumpPtrAllocator allocates in 4KiB chunks, which with any larger project is going to result in a large number of allocations. Increasing allocation size this way can save 10%-20% of symbol load time for a huge C++ project with correctly built debuginfo (specifically, attaching to LibreOffice Calc built with -gpubnames -gdwarf-aranges goes down from ~22s to ~18s).


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D68549

Files:
  lldb/source/Utility/ConstString.cpp


Index: lldb/source/Utility/ConstString.cpp
===================================================================
--- lldb/source/Utility/ConstString.cpp
+++ lldb/source/Utility/ConstString.cpp
@@ -31,7 +31,10 @@
 class Pool {
 public:
   typedef const char *StringPoolValueType;
-  typedef llvm::StringMap<StringPoolValueType, llvm::BumpPtrAllocator>
+  // BumpPtrAllocator allocates in 4KiB chunks, any larger C++ project is going
+  // to have megabytes of symbols, so allocate in larger chunks.
+  typedef llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 1048576> Allocator;
+  typedef llvm::StringMap<StringPoolValueType, Allocator>
       StringPool;
   typedef llvm::StringMapEntry<StringPoolValueType> StringPoolEntryType;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68549.223404.patch
Type: text/x-patch
Size: 731 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191006/a28ca61b/attachment.bin>


More information about the lldb-commits mailing list