You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Detect how many CPU cores are available
cores=$( (nproc --all || sysctl -n hw.ncpu) 2>/dev/null || echo 1 )
This command will detect the number of CPU cores available on either Linux (nproc) or BSD-like systems (sysctl), including FreeBSD and macOS, and just fall back to 1 on all other systems, which is the same behavior the script currently has, where only one core is used.
And then replace every make with make -j "$cores" and the entire script runs almost 4 times faster on my system.
The text was updated successfully, but these errors were encountered:
Just add this at the very top of your script:
This command will detect the number of CPU cores available on either Linux (nproc) or BSD-like systems (sysctl), including FreeBSD and macOS, and just fall back to
1
on all other systems, which is the same behavior the script currently has, where only one core is used.And then replace every
make
withmake -j "$cores"
and the entire script runs almost 4 times faster on my system.The text was updated successfully, but these errors were encountered: