[all-commits] [llvm/llvm-project] 3edf82: [XRay] Reserve memory space ahead-of-time when rea...

Min-Yih Hsu via All-commits all-commits at lists.llvm.org
Fri Jan 12 16:34:51 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3edf82d5566ed5c9898f52b5591c05f6366d6bac
      https://github.com/llvm/llvm-project/commit/3edf82d5566ed5c9898f52b5591c05f6366d6bac
  Author: Min-Yih Hsu <min.hsu at sifive.com>
  Date:   2024-01-12 (Fri, 12 Jan 2024)

  Changed paths:
    M llvm/lib/XRay/Trace.cpp

  Log Message:
  -----------
  [XRay] Reserve memory space ahead-of-time when reading native format log (#76853)

XRay used to struggle reading large log files. It turned out the
bottleneck was primarily caused by the reallocation happens when
appending log entries into a std::vector.
This patch reserves the memory space ahead-of-time since the number of
entries is known for most cases. Making llvm-xray runs 1.8 times faster
and uses 1.4 times less physical memory when reading large (~2.6GB) log
files.




More information about the All-commits mailing list