[all-commits] [llvm/llvm-project] e5bdac: Optimize GSymCreator::finalize.

Greg Clayton via All-commits all-commits at lists.llvm.org
Wed May 12 15:18:31 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e5bdacba2e185034979fddd8bff2695bfcdd3056
      https://github.com/llvm/llvm-project/commit/e5bdacba2e185034979fddd8bff2695bfcdd3056
  Author: Greg Clayton <gclayton at fb.com>
  Date:   2021-05-12 (Wed, 12 May 2021)

  Changed paths:
    M llvm/lib/DebugInfo/GSYM/GsymCreator.cpp

  Log Message:
  -----------
  Optimize GSymCreator::finalize.

The algorithm removing duplicates from the Funcs list used to have
amortized quadratic time complexity because it was potentially
removing each entry using std::vector::erase individually. This
patch is now using a erase-remove idiom with an adapted
removeIfBinary algorithm.

Probably this was made under the assumption that these removals are
rare, but there are cases where the case of duplicate entries is
occurring frequently. In these cases, the actual runtime was very
poor, taking hours to process a single binary of around 1 GiB size
including debug info. Another factor contributing to that is the
frequent output of the warning, which is now removed.

It seems this is particularly an issue with GCC-compiled binaries,
rather than clang-built binaries.

Reviewed By: clayborg

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




More information about the All-commits mailing list