4 ms·
How does this differ from what make files have been doing for decades?
by flukus 10y ago
How does this differ from what make files have been doing for decades?
- Jtsummers 10y agoSeems to be finer grained. Make knows I only changed foo.c and only rebuilds what depends on that. This sees that foo.rs changed and reparsed it. Sees the AST didn't change, maybe we added comments or reformatted it, and stops.
- flukus 10y agoDoes it track changes or changes to the surface area? If I changed the implementation of a function but not the signature, would this cause a rebuild of the dependents?
- pcwalton 10y agoYou don't have to split up your code manually. You just write one Rust crate, splitting your code into files on whatever granularity you like (with mutual recursion fully supported), and the Rust compiler automatically does the rest. You don't have to write tedious header files; the compiler figures out all the dependencies automatically.
- flukus 10y agoI don't split up my code manually for the compiler, I do it for the humans, being compiler friendly is just a pleasant side effect. You can build java files the same way without header files, worst case scenario is you have some fat compilation units.
- pcwalton 10y ago> I don't split up my code manually for the compiler, I do it for the humans, being compiler friendly is just a pleasant side effect. There is no human benefit to having to copy and paste function signatures—and worse, the bodies of functions you want to be inlined, including all templates—into header files. There's also no benefit to having the compiler parse hundreds of KB of header files over and over and over again. > You can build java files the same way without header files, worst case scenario is you have some fat compilation units. Java (production implementations used in practice) performs whole program optimization via its JIT. It's nice for Java, but that isn't how Rust works.
- flukus 10y agoI don't disagree on the header files, no sane language designed today would include that. > Java (production implementations used in practice) performs whole program optimization via its JIT. It's nice for Java, but that isn't how Rust works. Whole program optimization isn't generally something you want on dev builds, which is where incremental compilation is useful. For a production build why wouldn't you do a full rebuild anyway?
- pcwalton 10y ago> Whole program optimization isn't generally something you want on dev builds, which is where incremental compilation is useful. By "whole program optimization" I also include things like generic/template instantiation. Whenever you use, say, a HashMap, you have to recompile the implementation of the HashMap specialized to the size, alignment, destructor, etc. of types you're using with it. > For a production build why wouldn't you do a full rebuild anyway? When I profile apps written in Rust, it's important for me to be able to get good turnaround time on optimized builds.
- imron 10y agoMakefiles work at the file level. This works at the abstract syntax tree level. If you change a file that many other files depend on Makefiles will recompile all those files. This approach will only recompile the parts affected by the change in AST which will likely be significantly less.