Skip to content

Commit 8581f56

Browse files
authored
Scons: revert providing the number of logical processors as the number of maximum concurrent jobs to speed up builds by default (#13371)
Reverts #13226 Summary of the issue: While building NVDA with multiple jobs leads to faster build times, it also leads to scrambled output which can be quite annoying when debugging. Description of how this pull request fixes the issue: Disable multiple jobs by default but warn users to run with -jX to get a faster build if applicable.
1 parent c267db9 commit 8581f56

3 files changed

Lines changed: 13 additions & 8 deletions

File tree

‎appveyor/scripts/setSconsArgs.ps1‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ if(!$env:APPVEYOR_PULL_REQUEST_NUMBER) {
1515
$sconsArgs += " certFile=appveyor\authenticode.pfx certTimestampServer=http://timestamp.digicert.com"
1616
}
1717
$sconsArgs += " version_build=$env:APPVEYOR_BUILD_NUMBER"
18-
# Use only 1 concurrent job when building
19-
$sconsArgs += " -j1"
2018
# We use cmd to run scons because PowerShell throws exceptions if warnings get dumped to stderr.
2119
# It's possible to work around this, but the workarounds have annoying side effects.
2220
Set-AppveyorBuildVariable "sconsOutTargets" $sconsOutTargets

‎sconstruct‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,17 @@ env.SetDefault(MSVC_VERSION='14.2')
130130
# speed up subsequent runs by checking timestamps of targets and dependencies, and only using md5 if timestamps differ.
131131
env.Decider('MD5-timestamp')
132132

133-
# Make sure to run the build on multiple threads so it runs faster
134-
env.SetOption('num_jobs', multiprocessing.cpu_count())
135-
realNumJobs = env.GetOption('num_jobs')
136-
print(f"Building using {realNumJobs} job{'s' if realNumJobs != 1 else ''}")
133+
# Warn to run the build on multiple threads so it runs faster
134+
numJobs = env.GetOption('num_jobs')
135+
numCores = multiprocessing.cpu_count()
136+
if numJobs < numCores:
137+
print(
138+
f"Warning: Building with {numJobs} concurrent job{'s' if numJobs != 1 else ''} "
139+
f"while {numCores} CPU threads are available. "
140+
f"Running SCONS with the parameter '-j{numCores}' may lead to a faster build."
141+
)
142+
else:
143+
print(f"Building with {numJobs} concurrent jobs")
137144

138145
#Make our recursiveCopy function available to any script using this environment
139146
env.AddMethod(recursiveCopy)

‎user_docs/en/changes.t2t‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ This ensures code will honor the Windows user setting for swapping the primary m
117117
- ``LOCALE_SLANGUAGE``, ``LOCALE_SLIST`` and ``LOCALE_SLANGDISPLAYNAME`` are removed from ``languageHandler`` - use members of ``languageHandler.LOCALE`` instead. (#12753)
118118
- Switched from Minhook to Microsoft Detours as a hooking library for NVDA. Hooking with this library is mainly used to aid the display model. (#12964)
119119
- ``winVersion.WIN10_RELEASE_NAME_TO_BUILDS`` is removed. (#13211)
120-
- SCons now builds with multiple concurrent jobs, equal to the number of logical processors in the system.
121-
This can dramatically decrease build times on multi core systems. (#13226)
120+
- SCons now warns to build with a number of jobs that is equal to the number of logical processors in the system.
121+
This can dramatically decrease build times on multi core systems. (#13226, #13371)
122122
- ``characterProcessing.SYMLVL_*`` constants are removed - please use ``characterProcessing.SymbolLevel.*`` instead. (#13248)
123123
- Functions ``loadState`` and ``saveState`` are removed from addonHandler - please use ``addonHandler.state.load`` and ``addonHandler.state.save`` instead. (#13245)
124124
- Moved the UWP/OneCore interaction layer of NVDAHelper [from C++/CX to C++/Winrt https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/move-to-winrt-from-cx]. (#10662)

0 commit comments

Comments
 (0)