protonscr

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

protonclosed
ValveSoftware/Proton#27 · opened 2018-08-22 by tcarrio · updated 2018-08-24 · 7 comments · github
Ttcarrio 2018-08-22 github

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.

VValmar33 2018-08-22 github

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

Ttcarrio 2018-08-22 github

@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.

Fflukejones 2018-08-22 github

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

Ttcarrio 2018-08-22 github

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

22A4U 2018-08-24 github

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}

Ppchome 2018-08-24 github

build_proton.sh -j5

Aaeikum 2018-08-24 github

Fixed by 0d9ec29b5e3dea0d536e9da230f4f9f97d03a9fc.

Nothing extracted yet.