WebAssembly / WebAssembly/binaryen

Adding unsubtyping to O3

Open
#6,622 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
8.6k
Forks
885
Avg merge
1d 19h
Merged PRs (30d)
69

Description

I experimented with adding the unsubtyping pass to the O3 pipeline. I tried inserting it in two places in the global pre-passes: before type-refining and before constant field propagation. The results of the experiment are below. The control is the current j2wasm build pipeline that explicitly runs unsubtyping multiple times. Those explicit passes are removed in the experimental runs. The timing data is from running a single -O3 locally on a very large j2wasm wat file and includes parsing time.

  size O3 time
control 1 1
both 0.9989504951 1.407407407
first 0.9990367019 1.362962963
second 0.9990974859 1.237037037

I think that the results show that it would be enough to add unsubtyping in the second position (before cfp), but it would be worth trying to improve its performance first.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the O3 pipeline's global pre-passes, especially the type-refining and constant field propagation positions, and inspect how j2wasm currently runs unsubtyping explicitly. Reproduce the control and placement timing on a large j2wasm WAT file. Done means the pass placement and any performance improvement are supported by updated benchmark results.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.