[all-commits] [llvm/llvm-project] ff7b42: [memprof] Speed up llvm-profdata (#117446)

Kazu Hirata via All-commits all-commits at lists.llvm.org
Sun Nov 24 21:09:15 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ff7b42c194e0fa23e6a76f0a33a80c0c3af14e7d
      https://github.com/llvm/llvm-project/commit/ff7b42c194e0fa23e6a76f0a33a80c0c3af14e7d
  Author: Kazu Hirata <kazu at google.com>
  Date:   2024-11-24 (Sun, 24 Nov 2024)

  Changed paths:
    M llvm/include/llvm/ProfileData/MemProf.h
    M llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
    M llvm/lib/ProfileData/InstrProfWriter.cpp
    M llvm/lib/ProfileData/MemProf.cpp
    M llvm/unittests/ProfileData/MemProfTest.cpp

  Log Message:
  -----------
  [memprof] Speed up llvm-profdata (#117446)

CallStackRadixTreeBuilder::build takes the parameter
MemProfFrameIndexes by value, involving copies:

  std::optional<const llvm::DenseMap<FrameIdTy, LinearFrameId>>
    MemProfFrameIndexes

Then "build" makes another copy of MemProfFrameIndexe and passes it to
encodeCallStack for every call stack, which is painfully slow.

This patch changes the type to a pointer so that we don't have to make
a copy every time we pass the argument.

Without this patch, it takes 553 seconds to run "llvm-profdata merge"
on a large MemProf raw profile.  This patch shortenes that down to 67
seconds.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list