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

lumni1968 picture lumni1968  路  3Comments

lucifertdark picture lucifertdark  路  3Comments

leifmetcalf picture leifmetcalf  路  3Comments

ghost picture ghost  路  3Comments

shanefagan picture shanefagan  路  3Comments