[all-commits] [llvm/llvm-project] b0572a: Improve performance when parsing symbol tables in ...

Greg Clayton via All-commits all-commits at lists.llvm.org
Wed Jun 2 10:31:55 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b0572abf72fd4aafbb56bc41350e41bdfd96cdde
      https://github.com/llvm/llvm-project/commit/b0572abf72fd4aafbb56bc41350e41bdfd96cdde
  Author: Greg Clayton <gclayton at fb.com>
  Date:   2021-06-02 (Wed, 02 Jun 2021)

  Changed paths:
    M lldb/source/Core/Module.cpp
    M lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
    M lldb/source/Symbol/ObjectFile.cpp

  Log Message:
  -----------
  Improve performance when parsing symbol tables in mach-o files.

Some larger projects were loading quite slowly with the current LLDB on macOS and macOS simulator builds. I did some instrument traces and found 3 main culprits:
- a LLDB timer that was put into a function that was called too often
- a std::set that was keeping track of the address of symbols that were already added
- a unnamed function generator in ObjectFile that was going slow due to allocations

In order to see this in action I ran the latest LLDB on a large application with many frameworks using the following method:

(lldb) script import time; start_time = time.perf_counter()
(lldb) file Large.app
(lldb) script print(time.perf_counter() - start_time)

I first range "sudo purge" to clear the system file caches to simulate a cold startup of the debugger, followed by two iterations with warm file caches.

Prior to this fix I was seeing the following timings:

17.68 (cold)
14.56 (warm 1)
14.52 (warm 2)

After this fix I was seeing:

11.32 (cold)
8.43 (warm 1)
8.49 (warm 2)

Differential Revision: https://reviews.llvm.org/D103504




More information about the All-commits mailing list