Hope to achieve second-level compilation in the development stage

Hope to achieve rust compilation in seconds during the development phase

I found that rust compilation is very slow during the development phase, and I don't know what it is doing. This is extremely bad for the development experience, and it is actually one of the core reasons that prevent me from using rust. When I was developing tauri, I didn't want to wait for 10 seconds to see page feedback after adding a method

Parts that can be optimized:

  1. Rust analysis can be completely executed in the background at runtime
  2. During the development phase, grammatical structural errors can be completely ignored and compiled directly. Because there is background analysis, errors can still be marked, and then the complete analysis is transferred to the build and release phase
  3. No optimization is required at the debugging phase, and we can even accept the overhead of the just-in-time compiler and execution efficiency being reduced by 100 times. But we hope that it can compile the latest code in time

A lot of the analysis rustc does is actually necessary for codegen. For example typeck determines which functions to call and borrowck determines the set of variables to include in closures.

We already don't do optimizations in debug mode by default except for a couple that actually make compilation faster by reducing the amount of IR LLVM has to churn through.

1 Like