WebAssembly / WebAssembly/binaryen
Improving Precompute performance
Nobody has claimed this yet.
- Dominant language
- WebAssembly
- Stars
- 8.6k
- Forks
- 885
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 69
Description
Running on the binary from Google Sheets,
BINARYEN_CORES=1 perf record bin/wasm-opt binary.wasm -all --precompute --no-validation
(1 core to avoid noise from multithreading; validation disabled to focus on the optimization)
The top item from perf report is
7.41% wasm-opt libbinaryen.so [.] wasm::Type::isRef() const
Reading the code, I can't see an obvious reason for that slowness.
@tlively You mentioned some lock you might look into with wasm::Type - is this related? I don't seem to see a lock taken here though.
My only other guess is that this may just be called many times, and by not being in a header, it isn't getting inlined.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the profile with bin/wasm-opt and the BINARYEN_CORES=1 perf record command using --precompute and --no-validation. Start by examining wasm::Type::isRef() const and the surrounding wasm::Type implementation, then use perf report to determine whether call frequency, missing inlining, or another factor accounts for the cost. Done means identifying and addressing the performance cause with measurements showing an improvement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, wasm
- Domain
- compilers, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100