3 ms·
> Compilation time is terrible, I need something between 20 and 40 seconds for edit-compile-cycle (MacBook Pro 2016, i7, 16gb ram) A trick available on newer r
by cesarb 7y ago
> Compilation time is terrible, I need something between 20 and 40 seconds for edit-compile-cycle (MacBook Pro 2016, i7, 16gb ram)
A trick available on newer releases of rustc is "cargo check", that stops the compilation before the code generation (which is the slow part). If all you need at the moment is to see whether it would compile (no syntax errors, no wrong types, no borrow check errors), it can help a lot.
- staticassertion 7y agoI also work on a ~15kloc rust project. I use cargo check all the time. Still extremely slow, not to mention that my whole system can be locked up by rustc, which really kills development. I'll probably find a way to cgroup rustc just to deal with this issue.
- pimeys 7y agoI solved this by building myself a 3950x workstation. 16 cores and 32 GB of RAM does miracles for Rust workflows. That and the guidance kouteiheika gave above puts you far already.
- staticassertion 7y agoYeah I have 8 cores(HT) and 16GB, which is apparently just not enough. I think my plan is to just move builds to some kinda EC2 instance that I can bulk up.
- pimeys 7y agoIt's probably just the thermals. A desktop CPU runs circles over any laptop due to tremendously better thermals and power window.
- staticassertion 7y agoIt's possible, but my laptop runs fairly cool - it's elevated on a stand and is 18 inches, with a lot of ventilation. Of course it doesn't compare to a desktop system, but even still, this thing is hardly weak. It's a bit absurd to require 16 cores and 32GB of RAM to be productive.
- pjmlp 7y agoWhich means other system languages will continue to thrive for developers not so lucky with Rust compiler rigs.
- pimeys 7y agoThe funny thing is I paid about the same from my rig that people pay for a Macbook Pro. It is not really unaffordable and you get a great development machine. Of course nowadays the combination of Emacs and rust-analyzer gives you a very fast and nice workflow. That and one terminal running cargo watch -s 'clear; cargo check --tests --color=always 2>&1 | head -40' works miracles.