Open kateinoigakukun opened 1 year ago
It looks like the main bottleneck is musl's atomic operations. Actually, multithreaded code doesn't contribute the speed at all... Self-built wasm-opt linked with glibc is 5x faster than the prebuilt binary distributed on GitHub Release of binaryen repo.
$ time BINARYEN_CORES=1 wasm-opt-musl --asyncify -O3 -g --pass-arg=asyncify-ignore-imports -o ruby.opt ../ruby.raw
52.08s user 1.60s system 99% cpu 53.726 total
$ time wasm-opt-musl
--asyncify -O3 -g --pass-arg=asyncify-ignore-imports -o ruby.opt ../ruby.raw;
252.25s user 496.39s system 1321% cpu 56.640 total
$ time wasm-opt-glibc --asyncify -O3 -g --pass-arg=asyncify-ignore-imports -o ruby.opt ../ruby.raw;
73.84s user 0.42s system 747% cpu 9.927 total
Asyncify pass is super slow against CRuby. Let's optimize the Asyncify pass implementation in Binaryen