Skip to content

perf: use unordered_set for Name sets for better compile speed#8586

Open
Changqing-JING wants to merge 2 commits intoWebAssembly:mainfrom
Changqing-JING:opt/compile-speed
Open

perf: use unordered_set for Name sets for better compile speed#8586
Changqing-JING wants to merge 2 commits intoWebAssembly:mainfrom
Changqing-JING:opt/compile-speed

Conversation

@Changqing-JING
Copy link
Copy Markdown
Contributor

@Changqing-JING Changqing-JING commented Apr 9, 2026

wasm::Name has an O(1) pointer-based hash but operator< does O(n) memcmp, making std::set<Name> unnecessarily slow. On large workloads, ~35% of wasm-opt CPU time was spent in __memcmp_evex_movbe inside EffectAnalyzer::walk called from CodeFolding. Switching the four std::set<Name> fields in EffectAnalyzer, NameSet in branch-utils.h, and the local containers in CodeFolding to their unordered equivalents eliminates the bottleneck.

@Changqing-JING Changqing-JING marked this pull request as draft April 9, 2026 05:32
@Changqing-JING Changqing-JING requested a review from a team as a code owner April 9, 2026 05:32
@Changqing-JING Changqing-JING requested review from tlively and removed request for a team April 9, 2026 05:32
@Changqing-JING Changqing-JING marked this pull request as ready for review April 9, 2026 09:38
@Changqing-JING Changqing-JING marked this pull request as draft April 9, 2026 10:17
@Changqing-JING Changqing-JING marked this pull request as ready for review April 9, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant