Proton: build_proton.sh uses 4 jobs no matter how many cores are available

Created on 22 Aug 2018  Â·  7Comments  Â·  Source: ValveSoftware/Proton

The build process could be sped up on systems with more than 4 cores available.

Right now it sets JOBS=-j5 which is a reasonable default but doesn't optimize based on available resources.

Most helpful comment

On macOS the command sysctl -n hw.ncpu should work. nproc is not available.

All 7 comments

It would be better to just use something like make -j$(nproc)

@Valmar33 I was initially going to leave it as that, however I'm unfamiliar whether macOS includes this command by default and what the behavior would be on that platform, or any others that don't.

If macOS includes this, that would be a better move. I simply wanted to support Linux/macOS building and maintain the same core_count + 1 as it was previously.

On macOS the command sysctl -n hw.ncpu should work. nproc is not available.

@Luke-Nukem Awesome, this seems like this should work! :confetti_ball:

Compile based on number of threads available on system (not cores):

readarray -t -s3 -n3 threads <<< $(lscpu) ; export threads=$((${threads[0]/:}${threads[2]/*:}))

or

readarray -t -s3 -n3 threads <<< $(lscpu) ; export threads=$((${threads[0]/:[[:space:]]}${threads[2]/:*[[:space:]]}))

then:

make -j${threads}

build_proton.sh -j5

Fixed by 0d9ec29b5e3dea0d536e9da230f4f9f97d03a9fc.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AwesamLinux picture AwesamLinux  Â·  3Comments

kforney picture kforney  Â·  3Comments

lucifertdark picture lucifertdark  Â·  3Comments

raikirii picture raikirii  Â·  3Comments

BLaDZer picture BLaDZer  Â·  3Comments