|
| 1 | +# v1.1.0 Corpus Baseline -- LOOM vs wasm-opt -O3 |
| 2 | + |
| 3 | +_Generated by `scripts/measure_corpus.sh` at `2026-05-20T05:26:16Z`._ |
| 4 | + |
| 5 | +- LOOM commit: `6ae62ed26f3a4e82d25d14e27adbbb615a45298b` |
| 6 | +- LOOM branch: `main` |
| 7 | +- LOOM version: `loom 1.0.5` |
| 8 | +- wasm-opt: `wasm-opt version 116 (version_116)` (used) |
| 9 | +- wasm-tools: `wasm-tools 1.243.0` |
| 10 | + |
| 11 | +## Headline |
| 12 | + |
| 13 | +On this corpus (only workloads where both LOOM and wasm-opt produced valid output): LOOM produced a **smaller** output than wasm-opt on: gale. wasm-opt beats LOOM on: httparse, state_machine, json_lite. |
| 14 | + |
| 15 | +Missing fixtures (skipped, marked `n/a`): |
| 16 | +- `nom_numbers` |
| 17 | +- `loom` |
| 18 | +- `calculator` |
| 19 | +- `meld_fused` |
| 20 | + |
| 21 | +## Red rows |
| 22 | + |
| 23 | +- :red_circle: httparse: wasm-opt beats LOOM by 6,23% of baseline -> gap analysis recommended |
| 24 | +- :red_circle: state_machine: wasm-opt beats LOOM by 9,00% of baseline -> gap analysis recommended |
| 25 | +- :red_circle: json_lite: wasm-opt beats LOOM by 10,51% of baseline -> gap analysis recommended |
| 26 | + |
| 27 | +## Results — file size (total bytes incl. all sections) |
| 28 | + |
| 29 | +_File bytes include type / import / export / global and custom sections_ |
| 30 | +_(name, debug, attestation, dylink). These can change without code changes;_ |
| 31 | +_see the **code-section table** below for optimizer-relevant deltas._ |
| 32 | + |
| 33 | +| Workload | Baseline | LOOM | wasm-opt -O3 | wasm-opt → LOOM | LOOM Δ% | wasm-opt Δ% | Note | |
| 34 | +|---|---:|---:|---:|---:|---:|---:|---| |
| 35 | +| gale | 1941 | 1846 | 1925 | 1846 | -4,9 | -0,8 | kernel-FFI fixture | |
| 36 | +| :red_circle: httparse | 4766 | 4668 | 4371 | 4292 | -2,1 | -8,3 | HTTP parser | |
| 37 | +| nom_numbers | n/a | n/a | n/a | n/a | n/a | n/a | parser-combinator primitives | |
| 38 | +| :red_circle: state_machine | 1655 | 1558 | 1409 | 1321 | -5,9 | -14,9 | FSM kernel | |
| 39 | +| :red_circle: json_lite | 3510 | 3377 | 3008 | 2929 | -3,8 | -14,3 | minimal JSON tokenizer | |
| 40 | +| loom | n/a | n/a | n/a | n/a | n/a | n/a | LOOM self-build (dogfood target) | |
| 41 | +| calculator | n/a | n/a | n/a | n/a | n/a | n/a | component-shaped fixture | |
| 42 | +| calculator_root | 2337724 | error | error | n/a | n/a | n/a | 2.3 MB component (root, large) | |
| 43 | +| simple_component | 261 | 212 | error | n/a | -18,8 | n/a | tiny component (adapter-heavy) | |
| 44 | +| calc_component | 442 | 392 | error | n/a | -11,3 | n/a | small component (adapter-heavy) | |
| 45 | +| meld_fused | n/a | n/a | n/a | n/a | n/a | n/a | real meld-fused multi-component core (Track 3 target — see tests/corpus/MELD_FUSED_README.md) | |
| 46 | + |
| 47 | +## Results — code section only (optimizer-relevant) |
| 48 | + |
| 49 | +_Bytes of the wasm code section (function bodies) only — the surface_ |
| 50 | +_an optimizer actually changes. Use these deltas to compare optimizer_ |
| 51 | +_effectiveness fairly (independent of debug-info / attestation noise)._ |
| 52 | + |
| 53 | +| Workload | Baseline (code) | LOOM (code) | wasm-opt (code) | LOOM code Δ% | wasm-opt code Δ% | Note | |
| 54 | +|---|---:|---:|---:|---:|---:|---| |
| 55 | +| gale | 811 | 795 | 795 | -2,0 | -2,0 | kernel-FFI fixture | |
| 56 | +| httparse | 3452 | 3433 | 3399 | -0,6 | -1,5 | HTTP parser | |
| 57 | +| nom_numbers | n/a | n/a | n/a | n/a | n/a | parser-combinator primitives | |
| 58 | +| state_machine | 1055 | 1037 | 992 | -1,7 | -6,0 | FSM kernel | |
| 59 | +| json_lite | 2125 | 2071 | 2017 | -2,5 | -5,1 | minimal JSON tokenizer | |
| 60 | +| loom | n/a | n/a | n/a | n/a | n/a | LOOM self-build (dogfood target) | |
| 61 | +| calculator | n/a | n/a | n/a | n/a | n/a | component-shaped fixture | |
| 62 | +| calculator_root | 106017 | n/a | n/a | n/a | n/a | 2.3 MB component (root, large) | |
| 63 | +| simple_component | 9 | 9 | n/a | +0,0 | n/a | tiny component (adapter-heavy) | |
| 64 | +| calc_component | 33 | 33 | n/a | +0,0 | n/a | small component (adapter-heavy) | |
| 65 | +| meld_fused | n/a | n/a | n/a | n/a | n/a | real meld-fused multi-component core (Track 3 target — see tests/corpus/MELD_FUSED_README.md) | |
| 66 | + |
| 67 | +## Components via meld (fused-core baseline) |
| 68 | + |
| 69 | +_For Component-Model fixtures, wasm-opt cannot process the component |
| 70 | +directly. `meld fuse` produces a single core module from the component; |
| 71 | +that fused core is its own baseline and is structurally different from the |
| 72 | +original component. The deltas below compare wasm-opt and LOOM against the |
| 73 | +**meld output** as baseline._ |
| 74 | + |
| 75 | +| Workload | meld baseline | wasm-opt -O3 | LOOM | wasm-opt Δ% | LOOM Δ% | Note | |
| 76 | +|---|---:|---:|---:|---:|---:|---| |
| 77 | +| calculator_root | 128764 | 114639 | n/a | -11,0 | n/a | 2.3 MB component (root, large) | |
| 78 | +| simple_component | 90 | 90 | 41 | +0,0 | -54,4 | tiny component (adapter-heavy) | |
| 79 | +| calc_component | 135 | 135 | 86 | +0,0 | -36,3 | small component (adapter-heavy) | |
| 80 | + |
| 81 | +## Methodology |
| 82 | + |
| 83 | +For each workload (fixture path is relative to repo root): |
| 84 | +1. Record baseline byte count via `wc -c` and code-section size via `wasm-tools dump`. |
| 85 | +2. Run `loom optimize <fixture> -o <name>.loom.wasm`. |
| 86 | +3. Run `wasm-opt -O3 <fixture> -o <name>.wopt.wasm` (skipped if wasm-opt unavailable). |
| 87 | +4. Re-run LOOM on the wasm-opt output (`wasm-opt -> LOOM` column). |
| 88 | +5. Validate every output via `wasm-tools validate`. **A validation failure is a HARD ERROR** -- the harness aborts with exit code 2. |
| 89 | + |
| 90 | +Conventions: |
| 91 | +- Δ% is `(out - base) / base * 100`. Negative means smaller (better). |
| 92 | +- A row is flagged :red_circle: if LOOM grew the file vs. baseline, or if wasm-opt beats LOOM by more than 1% of baseline. |
| 93 | +- Outputs of every run are in `/tmp/loom-measure-corpus` for forensic inspection. |
| 94 | + |
| 95 | +## Reproducing |
| 96 | + |
| 97 | +```bash |
| 98 | +# Build LOOM first (Z3 verification enabled) |
| 99 | +Z3_SYS_Z3_HEADER=/opt/homebrew/include/z3.h \ |
| 100 | + LIBRARY_PATH=/opt/homebrew/lib cargo build --release |
| 101 | + |
| 102 | +# Run the harness |
| 103 | +bash scripts/measure_corpus.sh |
| 104 | +``` |
0 commit comments