Stream: git-wasmtime

Topic: wasmtime / issue #15335 Cranelift: compile time quadratic...


view this post on Zulip Wasmtime GitHub notifications bot (Nov 17 2026 at 22:06):

alexcrichton opened issue #15335:

This script:

import sys
d, n = int(sys.argv[1]), 20000
print('(module (func (param i32) (result i32) (local i32)',
      'loop ' * d,
      'local.get 1', 'local.get 0 i32.add ' * n, 'local.set 1',
      ' '.join(f'local.get 0 br_if {k}' for k in range(d)),
      'end ' * d,
      'local.get 1))')

generates a module that takes a long time to compile:

d1000.wasm.txt
d2000.wasm.txt

$ python3 gen.py 1000 > d1000.wat
$ python3 gen.py 2000 > d2000.wat
$ time cargo run --release -- compile d1000.wat
13.56s
$ time cargo run --release -- compile d2000.wat
55.16s

Wasmtime 50.0.1 compiles each of them in about 0.1s.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 17 2026 at 22:06):

alexcrichton added the cranelift:goal:compile-time label to Issue #15335.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 17 2026 at 22:07):

alexcrichton commented on issue #15335:

cc @wraitii from #15201

view this post on Zulip Wasmtime GitHub notifications bot (Nov 17 2026 at 22:44):

cfallin commented on issue #15335:

This is pretty likely the added is_in_loop call when computing hoist_level; that walks up the loopnest tree. I suspect we could do a DFS pre/postnumber trick to get constant-time is-in-loop tests...

view this post on Zulip Wasmtime GitHub notifications bot (Nov 17 2026 at 22:44):

cfallin commented on issue #15335:

(@wraitii if you want to try that, go ahead, otherwise this will go on my List Of Things To Do and will be processed... at some future point)

view this post on Zulip Wasmtime GitHub notifications bot (Nov 18 2026 at 07:13):

wraitii commented on issue #15335:

Mh will try and give this a look, feel free to revert the change too if this is a blocker.

view this post on Zulip Wasmtime GitHub notifications bot (Nov 18 2026 at 22:24):

cfallin closed issue #15335:

This script:

import sys
d, n = int(sys.argv[1]), 20000
print('(module (func (param i32) (result i32) (local i32)',
      'loop ' * d,
      'local.get 1', 'local.get 0 i32.add ' * n, 'local.set 1',
      ' '.join(f'local.get 0 br_if {k}' for k in range(d)),
      'end ' * d,
      'local.get 1))')

generates a module that takes a long time to compile:

d1000.wasm.txt
d2000.wasm.txt

$ python3 gen.py 1000 > d1000.wat
$ python3 gen.py 2000 > d2000.wat
$ time cargo run --release -- compile d1000.wat
13.56s
$ time cargo run --release -- compile d2000.wat
55.16s

Wasmtime 50.0.1 compiles each of them in about 0.1s.


Last updated: Nov 19 2026 at 20:05 UTC