Hardware requirements for Substrate engineer

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…

1 Like

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!

1 Like

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.

2 Likes

The M1 Macbook Pro was a game changer for me too.

I do pretty much all my development on it, and it really no longer feels like the compile time is every 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:

➜  substrate git:(polkadot-v0.9.37) git branch --show-current 
polkadot-v0.9.37
➜  substrate git:(polkadot-v0.9.37) cargo clean
➜  substrate git:(polkadot-v0.9.37) cargo build --release
Finished release [optimized] target(s) in 8m 18s
2 Likes

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.

1 Like

That’s really impressive.

I see no posts about linux laptops so I’ll fill in the gap. I’ve got thinkpad p14s, 32GB ram, ryzen 7 pro 5850U. Substrate compiles for around 18mins.

But as already mentioned - I rarely compile the whole project from scratch.

1 Like

Same, I invested in an M1 laptop a month after I joined and it made a dramatic difference.

As far as other techniques go, I use zld:

# ~/.cargo/config
# On MacOS: brew install michaeleisel/zld/zld
[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/opt/homebrew/bin/zld"]
[target.aarch64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/opt/homebrew/bin/zld"]

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.

does zld bring better performance to the table compared to ld64 for substrate in particular?

Good question! Someone should compare them and get numbers. :slightly_smiling_face:

1 Like

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 :wink: 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.

1 Like

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.