[llvm] [MemProf] Switch to DenseMap for performance (NFC) (PR #81035)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 7 12:45:28 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Teresa Johnson (teresajohnson)
<details>
<summary>Changes</summary>
Some profiling showed that the accesses to this map during bitcode
reading was incurring over 10% of the time in a large thin link. There
is no need for it to be std::map, and I measured around 8.5% time
reduction in the same thin link from switching to DenseMap.
---
Full diff: https://github.com/llvm/llvm-project/pull/81035.diff
1 Files Affected:
- (modified) llvm/include/llvm/IR/ModuleSummaryIndex.h (+1-1)
``````````diff
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index 395c9e332eb8f..d5ff15063671d 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -1377,7 +1377,7 @@ class ModuleSummaryIndex {
// Temporary map while building StackIds list. Clear when index is completely
// built via releaseTemporaryMemory.
- std::map<uint64_t, unsigned> StackIdToIndex;
+ DenseMap<uint64_t, unsigned> StackIdToIndex;
// YAML I/O support.
friend yaml::MappingTraits<ModuleSummaryIndex>;
``````````
</details>
https://github.com/llvm/llvm-project/pull/81035
More information about the llvm-commits
mailing list