5 ms·
Can you share approaches you've used to drop compile times? I'm wondering if there's anything beyond avoiding macros and generics.
by swsieber 6y ago
Can you share approaches you've used to drop compile times? I'm wondering if there's anything beyond avoiding macros and generics.
- steveklabnik 6y agoHonestly, it's stuff that's very specific to "writing a whole operating system in Rust," and so unlikely to be broadly useful. Basically, we were doing a lot of "spurious" re-builds of crates, because we were changing flags between compilations, and with some creativity, we didn't actually need to do that. If you're not building a bunch of things multiple different times in slightly different ways, it's not relevant. I will say that I recently discovered that putting a bunch of crates into a workspace is inherently slower than compiling them all separately, which is pretty surprising. I haven't dug into the exact reason yet, but it makes 4x the syscalls, so I'm assuming that it's checking every single dep of every single member and that has significant overlap. https://users.rust-lang.org/t/complex-build-advice/48779?u=steveklabnik https://users.rust-lang.org/t/complex-build-advice/48779?u=s... is probably closest to what I can currently say :)
- boris 6y agoQuoting from the linked discussion: > The issue with Makefiles is that well, they're not portable. I'm on Windows, and 99% of this stuff Just Works really really nicely, but that means that "just use Make" isn't a real option. I love that Rust's tooling is so cross-platform, and this is just a final pain point. The problem is hard, but it's mostly about fiddly details. > I'm trying to figure out how good I can make this without throwing it all out and doing something else. If we never push Cargo's boundaries, it will never grow into being a good fit for these projects. The fundamental problem with Cargo is that it's not a general-purpose build system (like, say, make). It's a black box with a bunch of hooks for achieving certain common things that the black box itself doesn't handle. As a result, every time you step out of the "supported area", it will be yet another "final pain point" & "mostly about fiddly details". I agree make is not a good fit for a cross-platform project (nor is Meson, IMO, due to the Python dependency). But there are good (IMO) options in this area that meet your requirements (cross-platform, no external dependencies, etc). I can elaborate if you are interested.
- steveklabnik 6y agoSure, I'm always about hearing what works for folks. It is unlikely that we will switch away, but I'm always interested!
- boris 6y agoIn your case it would be more like "adding" a make-like tool to tie all the steps together rather than "switching away" from anything. The tool I have in mind is buid2[1] (full disclosure: I work on the project). In this context you would be using it as a portable (and saner) make replacement (though we do have a Rust module in the works but that is geared more toward multi-language C/C++ and Rust builds). In fact, if you are interested, I am prepared to put my money where my mouth is and code up a demo/prototype for you (without any expectations that the result will be used). [1] https://build2.org https://build2.org
- steveklabnik 6y agoThanks; I’ve heard of build2, and if you’re the one posting about it on /r/cpp, I’ve probably seen your posts there too. I’ll give it a try if I have some time!
- boris 6y agoYes, that's me. If/when you give it a try, feel free to ping me[1] with any questions or issues. [1] boris@build2.org, berium on reddit, boris-kolpackov on internals.rust-lang.