bytecodealliance / bytecodealliance/wasmtime

Troubleshooting slow Cranelift compile times

Open
#5,237 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

[Original Zulip topic](https://bytecodealliance.zulipchat.com/#narrow/stream/217117-cranelift/topic/Troubleshooting.20slow.20compile.20times/near/308768015)

Based on the above Zulip topic, I made this issue and attached the generated CLIF.

I'm using Cranelift as a backend for a language I'm working on. I also have an LLVM backend (via Inkwell). While messing around with some test code, I noticed that for a very large function (10000+ lines), my Cranelift backend takes longer (~4.0s) to generate code than my LLVM backend (~1.5s). Here's my crude test case source, which continues on for about 10000 lines.

![Screenshot 2022-11-09 032154](https://user-images.githubusercontent.com/40331937/200924038-deab1c9f-362f-4f10-b9fb-314cd37626e0.png)

```
define_function main: 3.4641968s
======== ======== ==================================
Total Self Pass
-------- -------- ----------------------------------
1.090 0.696 Verify Cranelift IR
0.314 0.314 Verify CPU flags
6.916 0.161 Compilation passes
0.040 0.040 Control flow graph
0.060 0.060 Dominator tree
0.000 0.000 Remove unreachable blocks
0.009 0.009 Remove constant phi-nodes
0.466 0.466 VCode lowering
0.225 0.225 VCode emission
0.001 0.001 VCode emission finalization
1.487 1.487 Register allocation
======== ======== ==================================
```

[clif.zip](https://github.com/bytecodealliance/wasmtime/files/9974510/clif.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.