Skip to content

Commit fc43f0d

Browse files
[NFC] Use unordered containers for Name sets in SimplifyLocals and DuplicateFunctionElimination (#8600)
This PR is proposed by #8586 (comment) The passes get 0.7% faster.
1 parent 54f9f7a commit fc43f0d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/passes/DuplicateFunctionElimination.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct DuplicateFunctionElimination : public Pass {
6464
});
6565
// Find actually equal functions and prepare to replace them
6666
std::map<Name, Name> replacements;
67-
std::set<Name> duplicates;
67+
std::unordered_set<Name> duplicates;
6868
for (auto& [_, group] : hashGroups) {
6969
Index size = group.size();
7070
if (size == 1) {

src/passes/SimplifyLocals.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ struct SimplifyLocals
102102
// a list of all sinkable traces that exit a block. the last
103103
// is falling off the end, others are branches. this is used for
104104
// block returns
105-
std::map<Name, std::vector<BlockBreak>> blockBreaks;
105+
std::unordered_map<Name, std::vector<BlockBreak>> blockBreaks;
106106

107107
// blocks that we can't produce a block return value for them.
108108
// (switch target, or some other reason)
109-
std::set<Name> unoptimizableBlocks;
109+
std::unordered_set<Name> unoptimizableBlocks;
110110

111111
// A stack of sinkables from the current traversal state. When
112112
// execution reaches an if-else, it splits, and can then

0 commit comments

Comments
 (0)