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:
$ 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.16sWasmtime 50.0.1 compiles each of them in about 0.1s.
alexcrichton added the cranelift:goal:compile-time label to Issue #15335.
alexcrichton commented on issue #15335:
cc @wraitii from #15201
cfallin commented on issue #15335:
This is pretty likely the added
is_in_loopcall when computinghoist_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...
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)
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.
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:
$ 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.16sWasmtime 50.0.1 compiles each of them in about 0.1s.
Last updated: Nov 19 2026 at 20:05 UTC