[all-commits] [llvm/llvm-project] 6505c6: [llvm-readobj] Optimize printing stack sizes to li...

Rahman Lavaee via All-commits all-commits at lists.llvm.org
Wed May 26 13:15:07 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6505c630407c5feec818f0bb1c284f9eeebf2071
      https://github.com/llvm/llvm-project/commit/6505c630407c5feec818f0bb1c284f9eeebf2071
  Author: Rahman Lavaee <rahmanl at google.com>
  Date:   2021-05-26 (Wed, 26 May 2021)

  Changed paths:
    M llvm/tools/llvm-readobj/ELFDumper.cpp

  Log Message:
  -----------
  [llvm-readobj] Optimize printing stack sizes to linear time.

Currently, each function name lookup is a linear iteration over all symbols defined in the object file which makes the total running time quadratic.

This patch optimizes the function name lookup by populating an **address to index** map upon the first function name lookup which is used to lookup each function name in O(1).

**impact**: For the clang binary built with `-fstack-size-section`, this improves the running time of `llvm-readobj --stack-size` from 7 minutes to 0.25 seconds.

Reviewed By: jhenderson

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




More information about the All-commits mailing list