Skip to content

Conversation

@kripken
Copy link
Member

@kripken kripken commented Nov 17, 2025

This is an over-approximation, as later iterations may have fewer calls - if we
remove a call. Such removal is rare, however, and the cost of computing this
map is actually very high. Computing it once up front, and using that over-
approximation, turns out to be much faster, even if in theory it can lead to a
little wasted work (more scanning; but no optimizations are missed, as we do
not use this mapping to decide what/how to optimize).

This makes the pass 30-40% faster on several large testcases I tried, from
Dart, Java, and C++. I did see two testcases that benefited only by 10-20%,
from GraalVM and Rust, but I saw none that did not benefit significantly.

This was the slowest pass in some of those 30-40% cases.

Helps #4165

Merge remote-tracking branch 'origin/main' into dae.new.2
@kripken kripken requested a review from tlively November 17, 2025 17:59
// param, we see the call is not reached). This is somewhat rare, and the cost
// of computing this map is significant, so we compute it once at the start
// and then use that possibly-over-approximating data.
std::vector<std::unordered_set<Name>> callers;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can make these even faster by making the inner set into another vector.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, done. I can't seem to measure a speedup from it, but maybe it depends on CPU or workload, and the vectors should be better.

kripken and others added 3 commits November 17, 2025 11:18
Co-authored-by: Thomas Lively <tlively123@gmail.com>
@kripken kripken enabled auto-merge (squash) November 17, 2025 23:21
@kripken kripken merged commit 7a39522 into WebAssembly:main Nov 17, 2025
16 checks passed
@kripken kripken deleted the dae.new.2 branch November 18, 2025 00:10
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.

2 participants