Live data from Hacker News

Rust Compile Times and Code Graphs

blog.danhhz.com

1–10 of 17 posts

Re: Rust Compile Times and Code Graphs

#2
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 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.

Re: Rust Compile Times and Code Graphs

#3
post #2

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 then compile. Som…

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.

Re: Rust Compile Times and Code Graphs

#4
post #2

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 then compile. Som…

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.

Re: Rust Compile Times and Code Graphs

#5
I really dislike the need to artificial decompose crates in this way. If Rust could accurately track dependencies at a more fine-grained level, then no one would do this because it adds complexity. It’s like optimizing assembly but for build systems.

What I mean by this is that if Rust tracked dependency information at the level of “my function too dependent on type declarations XYZ from crate A” vs “my function depends on the implementation of function in crate A”, then the Rust compiler would automatically apply this for you. It wouldn’t eliminate all dependency massaging, but it would eliminate the need for purely mechanical tasks and be more optimal (eg rearranging the internal fields of a crate shouldn’t dirty that dependency chain)

Re: Rust Compile Times and Code Graphs

#6
post #3
post #2

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 then compile. Som…

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.

Re: Rust Compile Times and Code Graphs

#7
post #2

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 then compile. Som…

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.

Re: Rust Compile Times and Code Graphs

#8
post #7
post #2

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 then compile. Som…

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.

Re: Rust Compile Times and Code Graphs

#9
post #2

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 then compile. Som…

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?

Re: Rust Compile Times and Code Graphs

#10

I really dislike the need to artificial decompose crates in this way. If Rust could accurately track dependencies at a more fine-grained level, then no one would do this because it adds complexity. It’s like optimizing assembly but for build systems. What I mean by this is that if Rust tracked dependency information at the level of “my function too dependent on type declarations XYZ from crate A” vs “my function depe…

That could indeed be done (and I want to make that happen at some point), but you must be aware that this is an optimization, and as such trivial unrelated code changes can make the compile times balloon because all of a sudden you added a field to a struct with a type that used to fall on the division boundary, and you went from multiple pseudo-crates to a single one. This kind of behavior is hell to debug and figure out as a user.
Post reply on HN