Skip to content

Commit 07a6f35

Browse files
authored
[wasm-split] Don't use ParallelFunctionAnalysis in scanModule (#9007)
This removes the use of `ParallelFunctionAnalysis` within `scanModule` (in `computeUsedNames`), which scans `UsedNames` for each module. I'm not 100% sure why but this improves running time at least for Dart applications. I also previously tried to use `ParallelFunctionAnalysis` in other functions but it resulted in slowdown so didn't do it. Maybe cache locality works against the parallelism. This reduces running time of acx_gallery (Jul 2026) by 7.8% (30.6s -> 28.2s) essentials by 4.2% (225.1s -> 215.6s).
1 parent 081f8cb commit 07a6f35

1 file changed

Lines changed: 5 additions & 19 deletions

File tree

src/ir/module-splitting.cpp

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -704,26 +704,12 @@ ModuleSplitter::PrimarySecondaryUsedNames ModuleSplitter::computeUsedNames() {
704704
// Given a module, collect names used in the module
705705
auto scanModule = [&](Module& module) {
706706
UsedNames used;
707-
ModuleUtils::ParallelFunctionAnalysis<UsedNames> nameCollector(
708-
module, [&](Function* func, UsedNames& used) {
709-
if (!func->imported()) {
710-
NameCollector(used).walk(func->body);
711-
}
712-
});
713-
714-
for (auto& [_, funcUsed] : nameCollector.map) {
715-
used.globals.insert(funcUsed.globals.begin(), funcUsed.globals.end());
716-
used.memories.insert(funcUsed.memories.begin(), funcUsed.memories.end());
717-
used.tables.insert(funcUsed.tables.begin(), funcUsed.tables.end());
718-
used.tags.insert(funcUsed.tags.begin(), funcUsed.tags.end());
719-
used.dataSegments.insert(funcUsed.dataSegments.begin(),
720-
funcUsed.dataSegments.end());
721-
used.elementSegments.insert(funcUsed.elementSegments.begin(),
722-
funcUsed.elementSegments.end());
723-
}
724-
725707
NameCollector collector(used);
726-
708+
for (auto& func : module.functions) {
709+
if (!func->imported()) {
710+
collector.walk(func->body);
711+
}
712+
}
727713
return used;
728714
};
729715

0 commit comments

Comments
 (0)