Skip to content

Commit

Permalink
build,win: limit maxcpucount to 2 for MSBuild
Browse files Browse the repository at this point in the history
MSBuild invokes cl.exe with /MP (set in common.gypi), making it
compile sources in parallel using a number of internal processes
equal to the number of effective processors. MSBuild /m uses a
similar mechanism, so the number of compiler processes can grow to
the number of effective processors squared.

This limits MSBuild to 2 processes, to still use some parallelization
while requiring less memory. Cl.exe is still invoked with /MP, thus
the maximum number of processes is limited to twice the number of
effective processors.

PR-URL: #12184
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
  • Loading branch information
joaocgreis authored and evanlucas committed May 2, 2017
1 parent 1ab998f commit 42e940c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,11 @@ echo Project files generated.
if defined nobuild goto sign

@rem Build the sln with msbuild.
set "msbcpu=/m:2"
if "%NUMBER_OF_PROCESSORS%"=="1" set "msbcpu=/m:1"
set "msbplatform=Win32"
if "%target_arch%"=="x64" set "msbplatform=x64"
msbuild node.sln /m /t:%target% /p:Configuration=%config% /p:Platform=%msbplatform% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
msbuild node.sln %msbcpu% /t:%target% /p:Configuration=%config% /p:Platform=%msbplatform% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
if errorlevel 1 goto exit
if "%target%" == "Clean" goto exit

Expand Down

0 comments on commit 42e940c

Please sign in to comment.