[all-commits] [llvm/llvm-project] fa5278: [lldb] Improve RichManglingContext ergonomics (NFC)

Jonas Devlieghere via All-commits all-commits at lists.llvm.org
Fri Feb 4 10:17:53 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fa52788b7a6da1eab9fec0f2db5f74a8db555196
      https://github.com/llvm/llvm-project/commit/fa52788b7a6da1eab9fec0f2db5f74a8db555196
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2022-02-04 (Fri, 04 Feb 2022)

  Changed paths:
    M lldb/include/lldb/Core/RichManglingContext.h
    M lldb/source/Core/Mangled.cpp
    M lldb/source/Core/RichManglingContext.cpp
    M lldb/source/Symbol/Symtab.cpp
    M lldb/unittests/Core/RichManglingContextTest.cpp

  Log Message:
  -----------
  [lldb] Improve RichManglingContext ergonomics (NFC)

Have the different ::Parse.* methods return the demangled string
directly instead of having to go through ::GetBufferRef.

Differential revision: https://reviews.llvm.org/D118953


  Commit: aed965d55d460ebcc2b442b9d799b4c1ab929157
      https://github.com/llvm/llvm-project/commit/aed965d55d460ebcc2b442b9d799b4c1ab929157
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2022-02-04 (Fri, 04 Feb 2022)

  Changed paths:
    M lldb/source/Core/Mangled.cpp
    M lldb/source/Symbol/Symtab.cpp
    M lldb/test/API/macosx/dyld-trie-symbols/TestDyldTrieSymbols.py

  Log Message:
  -----------
  [lldb] Don't construct the demangled strings while indexing the symbol table

The symbol table needs to demangle all symbol names when building its
index. However, this doesn't require the full mangled name: we only need
the base name and the function declaration context. Currently, we always
construct the demangled string during indexing and cache it in the
string pool as a way to speed up future lookups.

Constructing the demangled string is by far the most expensive step of
the demangling process, because the output string can be exponentially
larger than the input and unless you're dumping the symbol table, many
of those demangled names will not be needed again.

This patch avoids constructing the full demangled string when we can
partially demangle. This speeds up indexing and reduces memory usage.

I gathered some numbers by attaching to Slack:

Before
------

  Memory usage: 280MB
  Benchmark 1: ./bin/lldb -n Slack -o quit
    Time (mean ± σ):      4.829 s ±  0.518 s    [User: 4.012 s, System: 0.208 s]
    Range (min … max):    4.624 s …  6.294 s    10 runs

After
-----

  Memory usage: 189MB
  Benchmark 1: ./bin/lldb -n Slack -o quit
    Time (mean ± σ):      4.182 s ±  0.025 s    [User: 3.536 s, System: 0.192 s]
    Range (min … max):    4.152 s …  4.233 s    10 runs

Differential revision: https://reviews.llvm.org/D118814


Compare: https://github.com/llvm/llvm-project/compare/9d1857f69f4e...aed965d55d46


More information about the All-commits mailing list