bytecodealliance / bytecodealliance/wasmtime
Excessive compile time compiling huge element segment
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 121
Description
Compiling this module in Wasmtime: [foo.wasm.txt](https://github.com/user-attachments/files/31702582/foo.wasm.txt) (it's not actually txt) currently takes ~1s:
```
$ time wasmtime compile foo.wasm
wasmtime compile foo.wasm 0.99s user 0.24s system 99% cpu 1.235 total
```
The reason for this is that the module has a massive element segment full of null function expressions. This is effectively unrolled into a giant CLIF function that then takes quite awhile to compile.
Note though that optimizations actually improve the compile time of this function:
```
$ time wasmtime compile foo.wasm -O opt-level=0
wasmtime compile foo.wasm -O opt-level=0 1.29s user 0.27s system 99% cpu 1.566 total
```
I'm not sure how best to handle this, but it's timing out our fuzzers currently. I figured I'd file this so we can at least track it.
Contributor guide
Assessment
This issue has not been assessed yet.