|
|
|
|
|
by reuven
21 days ago
|
|
A very interesting point. Coding with AI definitely requires tight, fast loops. I don't have much experience with Rust, but I had heard that the compiler is slow (because it's doing so much thinking and checking in advance). I'm OK with Lisp output, but maybe that just shows how old I am. :-) I wonder if it's possible (or wise) to have two different compilers for a language -- one that's optimized for such tight loops, and another that does thorough checking, etc. You know, kind of like -O, but at a much deeper level. |
|
The compiler is indeed not particularly speedy, but the reason you were given is not entirely accurate. As measured in this blog post [0] different parts of the compilation pipeline will take different amounts of time depending on what you're doing (cargo check vs. incremental build vs. full build, building a library vs. binary, etc.), but generally speaking type/borrow checking take up relatively small portions of compilation time (~15% or less, based on eyeballing the charts [1, 2]) compared to everything else.
> one that's optimized for such tight loops, and another that does thorough checking
I think that would risk producing diverging language subsets, especially if the checks are essential for language semantics. For example, what exactly does it mean if a program passes the "relaxed" compiler but fails the "thorough" one? How close does that actually get you to a "real" working program?
[0]: https://kobzol.github.io/rust/rustc/2024/03/15/rustc-what-ta...
[1]: https://kobzol.github.io/assets/posts/compile-sections/binar...
[2]: https://kobzol.github.io/assets/posts/compile-sections/libra...