aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
diff options
context:
space:
mode:
authorAlex Langford <alangford@apple.com>2024-09-13 10:33:43 -0700
committerGitHub <noreply@github.com>2024-09-13 10:33:43 -0700
commit0351dc522a25df0473a63b414a5bfde5814d3dc3 (patch)
treec2ea4dfa4906d97d06ecabd6c61a4551a50ef335 /llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
parentb6bf27ef3c179eefd805f39aa681705fc980ceed (diff)
downloadllvm-0351dc522a25df0473a63b414a5bfde5814d3dc3.zip
llvm-0351dc522a25df0473a63b414a5bfde5814d3dc3.tar.gz
llvm-0351dc522a25df0473a63b414a5bfde5814d3dc3.tar.bz2
[lldb] Do not use LC_FUNCTION_STARTS data to determine symbol size as symbols are created (#106791)
Summary: This improves the performance of ObjectFileMacho::ParseSymtab by removing eager and expensive work in favor of doing it later in a less-expensive fashion. Experiment: My goal was to understand LLDB's startup time. First, I produced a Debug build of LLDB (no dSYM) and a Release+NoAsserts build of LLDB. The Release build debugged the Debug build as it debugged a small C++ program. I found that ObjectFileMachO::ParseSymtab accounted for somewhere between 1.2 and 1.3 seconds consistently. After applying this change, I consistently measured a reduction of approximately 100ms, putting the time closer to 1.1s and 1.2s on average. Background: ObjectFileMachO::ParseSymtab will incrementally create symbols by parsing nlist entries from the symtab section of a MachO binary. As it does this, it eagerly tries to determine the size of symbols (e.g. how long a function is) using LC_FUNCTION_STARTS data (or eh_frame if LC_FUNCTION_STARTS is unavailable). Concretely, this is done by performing a binary search on the function starts array and calculating the distance to the next function or the end of the section (whichever is smaller). However, this work is unnecessary for 2 reasons: 1. If you have debug symbol entries (i.e. STABs), the size of a function is usually stored right after the function's entry. Performing this work right before parsing the next entry is unnecessary work. 2. Calculating symbol sizes for symbols of size 0 is already performed in `Symtab::InitAddressIndexes` after all the symbols are added to the Symtab. It also does this more efficiently by walking over a list of symbols sorted by address, so the work to calculate the size per symbol is constant instead of O(log n).
Diffstat (limited to 'llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp')
0 files changed, 0 insertions, 0 deletions