Time is the most valuable currency, Substrate requires a lot of hardware resources - that is how things are going. I want to rise a bit side topic, but in my opinion important because of time.
What is recommended hardware for Substrate development? According to my research one of the best CPU is: AMD Threadripper 3970X 32 x 3,7 GHz for local environment. I know that it is possible to setup environment remotely via cargo-remote plugin.
Happy to hear about your hardware setup that is Substrate-oriented in long term horizon. Personally I do not recommend Substrate development on only laptop battery…
I started out with an Intel i5-7400 and 16gb of RAM, it was painfully slow for substrate compiling but I got by with it, I have since then upgraded to an AMD Ryzen 9 5950x and 32GB of RAM, plus a MacBook Pro with the m1 pro chip for when I’m traveling. Both of these machines allow me to compile substrate runtimes in under 5 minutes from 0 and a lot less from incremental compiles. I do recommend the Ryzen and also the MacBook Pro, they are both great at the job!
I was using M1 Mac mini and that’s already a good enough developer experience. I am currently using Macbook Pro with M1 Pro and generally ok with the compile time. Note that you are not supposed to compile the whole runtime all the time. Majority of the time are building unit tests which are much faster.
I do pretty much all my development on it, and it really no longer feels like the compile time is ever holding me back.
Of course, I have also become much more smart about compiling specific crates and targets to optimize how quickly I get results, but really the Apple Silicon cannot be understated.
Here is a benchmark using the latest Polkadot release on Substrate at the time of writing this post on a 2021 M1 MacBook Pro with 64 GB of RAM:
yeah m1 max for me is way faster than my i5 (first time blockchain dev so didn’t even know what machine i needed). what other software based techniques - os-specific linkers, compiler switches, substrate features (as in toml), caching (like sccache) - do you guys use esp for substrate dev? how does your usual dev cycle look like?
i think we should have a talk on setting up the substrate dev env, if it isnt there already, so that newcomers to substrate/other rust-based blockchains can get an idea prior about how to setup the optimum machine.
as well as sccache (not sure if cachepot is recommended instead?) I feel like these make a difference, though I don’t have hard numbers.
It would be great if we compiled some of these tips/techniques into a document for developers, as compile times are really crucial for a good dev experience.
If you don’t have multiple different target directories that you delete every 5mins, sccache/cachepot don’t bring anything. These are basically tools to have one shared target directory, but they only help when your project local target directory is empty (which isn’t the case after the first build). If you run them sccache/cachepot in some cluster to have distributed compilations it could improve your compile speed.
I also have a MacBook M1 Pro 64Gb with native Linux as mobile dev machine. At home I have a PC with some Ryzen from 2020 and 64Gb as well. In general the early build phase of Substrate benefits from having a lot of CPU cores, but later in the pipeline where we don’t have that much parallism anymore Single core performance is crucial. As you don’t recompile all the crates all the time, single core performance should be the crucial factor for day to day work.
Iiiinteresting. Sounds like it could also be useful if you switch branches often, or use git worktrees (different folder hence difference target/ for each worktree). Thanks for the extra details.
I have some recent notes on improving compile times and disk usage. Is it worth documenting somewhere? This is a frequent topic that comes up, especially with the new monorepo.
I looked at this recently and zld is now archived. The best linker nowadays is apparently one called sold, but it is paid and I didn’t bother to set it up. But the default linker that comes with Xcode 15 is now much faster than it was.
m3 max (16inch) cargo check takes 4min from fresh. Same time as my 5950x liquid cooled 16 core AMD (well maybe the laptop was a second or two faster). And it’s quieter and less weight.
Also the battery doesn’t take much of a dent at all. My lastest intel mac on the other hand would take 40 mins and use up most of the battery in the process.