How to speed up the build time of contract

When I try to build the sway contracts using the release build of the forc command my entire systems hangs. Can you suggest a way to overcome this

Hi, you would need to share details of your environment.

however, if you are using the Rust SDK, generally the default linker used by Rust is slower, you can try switching to the LLVM projects faster linker lld

in project root folder:

.cargo/config.toml

# On Linux:
# - Ubuntu, `sudo apt-get install lld clang`
# - Arch, `sudo pacman -S lld clang`
[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "linker=clang", "-C", "link-arg=-fuse-ld=lld"]

# On MacOS, `brew install llvm` and follow steps in `brew info llvm`
[target.x86_64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=lld"]

might ( or might not ) help in your specific scenario.