Hacker News new | ask | show | jobs
by wredue 982 days ago
2 minutes isn’t even really bad build times.

I think that part of “compile times suck” is that, when we are learning, we are building extremely small programs. Hundreds of lines at the very top end. During this phase of our personal development, we build a habit of writing a line of code, then compiling. Then changing an index, then compiling. Then realize we use a wrong variable, then compile. Then <some other minor thing> then compile.

Somewhere along the way, we get to needing to build thousands or hundreds of thousands of lines, and there’s very frequently no build up to this so our habit of making very minor change and then making the compiler tell us what’s wrong hurts.

4 comments

Which is exactly what we need when doing GUI and games in Rust.

If it can't compete with the compile times from. NET, Java, Dart, Typescript then it won't be used by most folks.

C++ already lost the GUI wars for a reason, now stuck being the low level implementation language for GUI frameworks, driven by other languages.

IME Typescript generally has far worse compile times than rust especially if you need to start splitting into packages or do anything more complex than stripping type annotations.
It never took me 15 minutes, like on a Gtk+rs project I have.
Depends on what you're doing. If you're type checking, it's usually happening in the background via LSP. If you're "compiling" to JS, use esbuild and its instant.
Depends if that 2 minutes is full build or incremental..if incremental that is unacceptable, should be more like 2 seconds.

Compiling to see if you have syntax errors? What do you not have an editor?

Yeah, and cargo check exists for that very reason. It does type checking without actually compiling the code. Rust-analyzer, the LSP server for Rust, runs `cargo check` whenever the file is saved, IIRC, and then shows you what the compiler said.
Incremental type checking is still painfully slow on a large codebase.
if you have a reasonably good IDE you don't really need to explicitly compile the whole program outside of when you want to run it.
Which on any kind of graphical application is all the time.
Because that IDE is compiling the code behind the scenes... (Usually somewhere on a spectrum between literally just using the real compiler, or failing spectacularly to match it.)
I'm going to risk being a little nit picky here and I'm sure you mean it differently and just used some bad examples. You really shouldn't be relying on your compiler to tell you that you used the wrong variable, however, and if you are, then you would likely benefit immensely from getting some better tools. Some IDE's will help you a lot of the way, but great linting will frankly completely remove your "need" to check to see if your small changes actually work or not.