I using Substrate-template-node to build pallet and my laptop have Core-i7 chip, but the time to build is range from 9-12 minutes. So, when I change code and have to wait to build and run.

So, my question is Is there anyway to build faster?

  • 1
    If you do cargo build --profile production then you will appreciate how much faster cargo build --release is.
    – Squirrel
    Mar 30, 2022 at 8:12
  • SKIP_WASM_BUILD can be used to only build the code in native mode. Which OS are you using? Different linkers can help a bit. An AMD 5950x can help a lot.
    – Squirrel
    Mar 30, 2022 at 8:17
  • Remember there's also cargo check that can be done first which is a lot faster, and faster still if you're in the directory of the pallet as it has less to build.
    – Squirrel
    Mar 30, 2022 at 8:19
  • @Squirrel I encountered this error when run cargo build --profile production :error: profile 'production' is not defined Mar 30, 2022 at 8:55
  • 1
    @Squirrel the solution will be fix it so that debug build works. Not using release build for debug build. Debug build certainly works for us so it is something can be fixed.
    – Bryan Chen
    Mar 31, 2022 at 1:55

3 Answers 3


Some answers recommend to build with --release or with a production profile. But this misses the point of the original question. If you do this the build will actually take longer due to a number of additional optimizations that are applied!

You should consider the difference between using cargo build and cargo check:

This will essentially compile the packages without performing the final step of code generation, which is faster than running cargo build.

(from the cargo-check docs)

So if you e.g. just want to check for compiler errors cargo check is already sufficient.

If you're really in need for faster binary builds then having a beefy remote machine on which you execute the build via cargo-remote can be an option. There are also reports that using a local sccache installation + setting the environment variable RUSTC_WRAPPER="sccache" speeds this process up due to the additional caching done through sccache.

  • marked as answer for detail answer.thank you! Mar 31, 2022 at 7:24

If you are building a pallet testing just the pallet instead of building the entire thing is better. Just run cargo check -p your_pallet_name.

  • hum, I need to build and run test. Mar 30, 2022 at 10:42
  • 2
    cargo test -p your_pallet_name would run just your pallets tests. Mar 30, 2022 at 12:47

rustflags = [ "-Zthreads=8" ] will help if you're on nightly. As far as I know this is not on by default so stick it in your ~/.cargo/config - Had it in there for months and not seen a down side.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.