[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
Wed Oct 16 09:41:22 PDT 2019


llunak added a comment.

In D68549#1710986 <https://reviews.llvm.org/D68549#1710986>, @teemperor wrote:

> We could also just let the allocator take a parameter so that is increases the growth size to do it every Nth slab (N=1 for us) and set a slightly larger starting size.


Heh, I wasn't exactly planning on getting into hacking base LLVM classes with this seemingly trivial commit. Oh well, a patch is at https://reviews.llvm.org/D69050 . If it gets accepted, I'll change ConstString to use BumpPtrAllocatorImpl<llvm::MallocAllocator, 16384, 16384, 1> and change the StringPool construction back to not having an explicit default.

> By the way, if I look at the flame graph for lldb starting up and setting a break point in an LLDB debug binary <https://teemperor.de/lldb-bench/data/extern-lldb-bt.svg>, it seems that on the benchmark server we spent less than 0.5% of the startup time in that allocator function and much more time in that other ConstString overhead (the double-hashing to find the StringPool, the different locking). I'm curious why the allocator logic is so disproportionally slow on your setup (0.5% vs 10-20%). The only real work we do in the allocator is calling malloc, so I assume calling malloc is much more expensive on your system?

It is more expensive, relatively speaking. I used -gpubnames, so my profile wastes no time in ManualDWARFIndex. And if your "LLDB debug binary" implies non-optimized, then I tested with an optimized build, which of course changes things. And finally I tested with debug LibreOffice build, which means tons of debug data, more than with Clang or LLDB, but processed quickly thanks to -gpubnames. Apparently at that point malloc, kernel memory handling, etc. costs can become measurable *shrug*. The cost of ConstString hashing etc. is even larger, but there I don't see as simple solution as tweaking the allocator.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68549





More information about the lldb-commits mailing list