[PATCH] D158689: [llvm-profdata] Fix dangling reference after D147740

Alexander Yermolovich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 16:53:57 PDT 2023


ayermolo added a comment.

In D158689#4615531 <https://reviews.llvm.org/D158689#4615531>, @huangjd wrote:

> DenseMap is significantly faster than std::unordered_map as previously used.
>
> Benchmarking with an internal profile for production, when reading the function offset table alone, the original implementation (before D147740 <https://reviews.llvm.org/D147740>), DenseMap, and unordered_map takes 1.2, 0.78, 0.82 s respectively, and reading the full profiles takes 34.6, 29.0, 31.4 s respectively. That means using a std::unordered_map is 5-8% slower. (Meanwhile the refactoring itself has been very significant regardless of which container to use)

IMHO a more robust solution wins over marginal performance gains. The unordered_map provides fundamental guarantees and doesn't require future code owners to deal with how/when insert into SampleProfileMap.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158689/new/

https://reviews.llvm.org/D158689



More information about the llvm-commits mailing list