SIGN IN SIGN UP

[wasm-split] Remove module elements in bulk (NFC) (#8990)

Previously we removed module elements one by one within a loop. But
because `Module` stores a module element in both a map and a vector,
removing a single module element using `removeModuleElement` is O(N),
because it needs to shift all vector elements after it:
https://github.com/WebAssembly/binaryen/blob/302396a676433152a32375a81d71e74687c97a1b/src/wasm/wasm.cpp#L1970-L1979

This removes module elements in bulk using `removeModuleElements`, which
does the shifting only once.

https://github.com/WebAssembly/binaryen/blob/302396a676433152a32375a81d71e74687c97a1b/src/wasm/wasm.cpp#L2004-L2018

Combined with #8986 and #9007, acx_gallery's running time improved by
55.2% (30.6s -> 13.7s), and essentials by 65% (225.1s -> 78.8s). (for
Jul 2026 version)

I guess the main reason for the running time increase in #8441 was this
O(N) `removeModuleElement` called within a loop after all.
H
Heejin Ahn committed
9bb57b3a4c5bcefc0e2be3e6bb1d4d72fffd5060
Parent: 7dd128d
Committed by GitHub <noreply@github.com> on 8/18/2026, 9:18:12 PM