backward-cpp icon indicating copy to clipboard operation
backward-cpp copied to clipboard

TraceResolver takes half a second for a full stack trace

Open cschreib opened this issue 3 years ago • 0 comments

To start with, thank you for this library! It was very easy to install and gave really nice traces...

My only problem thus far is that, at least with my current setup, creating traces is fairly slow; about half a second for each full stack trace. I was hoping I could use this library to record traces when creating objects. Then, later on, I could selectively print a few traces to find out where a particular object was created. Unfortunately, I need to do this for about 20 000 objects! With the current performance, the program would take 3h just creating the stack traces... I was expecting some overhead, but this is clearly not practical.

Here are information on my setup:

  • Operating system: Linux Mint 20.1
  • CPU architecture: amd64 (Ryzen 5 2600)
  • Compiler: clang 10 (-std=c++20)
  • Executable size (compiled in debug mode with debug info): 60MB
  • Backwards CMake configuration:
    • BACKWARD_HAS_UNWIND=1 (NB: using libunwind 1.2.1)
    • BACKWARD_HAS_BACKTRACE=0
    • BACKWARD_HAS_BACKTRACE_SYMBOL=0
    • BACKWARD_HAS_DW=1 (NB: using libdw 0.176)
    • BACKWARD_HAS_BFD=0
    • BACKWARD_HAS_DWARF=0

Time per ResolvedTrace:

  • CMAKE_BUILD_TYPE=Debug: 0.07s
  • CMAKE_BUILD_TYPE=RelWithDebInfo: 0.15s

Do you have recommendations to make this faster?

cschreib avatar Mar 06 '21 21:03 cschreib