From 0c93adc5546a4bd28b653cafa9e5c024f35b77ec Mon Sep 17 00:00:00 2001 From: Leonard de Ruijter Date: Mon, 10 Jan 2022 19:38:56 +0100 Subject: [PATCH 1/4] Scons: provide the number of logical processors as the number of maximum concurrent jobs to speed up builds --- sconstruct | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sconstruct b/sconstruct index 634576820b9..03183c78f52 100755 --- a/sconstruct +++ b/sconstruct @@ -7,6 +7,7 @@ import sys import os import platform +import multiprocessing # Ensure we are inside the Python virtual environment. nvdaVenv = os.getenv("NVDA_VENV") @@ -121,9 +122,13 @@ env = Environment(variables=vars,HOST_ARCH='x86',tools=[ "recursiveInstall" ]) -# speed up subsiquent runs by checking timestamps of targets and dependencies, and only using md5 if timestamps differ. +# speed up subsequent runs by checking timestamps of targets and dependencies, and only using md5 if timestamps differ. env.Decider('MD5-timestamp') +# Make sure to run the build on multiple threads so it runs faster +env.SetOption('num_jobs', multiprocessing.cpu_count()) +print(f"Building using {env.GetOption('num_jobs')} jobs") + #Make our recursiveCopy function available to any script using this environment env.AddMethod(recursiveCopy) From af8f88b81a9a99d68d7a52e79ebffd6aef52b916 Mon Sep 17 00:00:00 2001 From: Leonard de Ruijter Date: Thu, 13 Jan 2022 19:34:34 +0100 Subject: [PATCH 2/4] Only one job on appveyor --- appveyor/scripts/setSconsArgs.ps1 | 2 ++ sconstruct | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/appveyor/scripts/setSconsArgs.ps1 b/appveyor/scripts/setSconsArgs.ps1 index 9c4dd3eca7b..55bc9ae5812 100644 --- a/appveyor/scripts/setSconsArgs.ps1 +++ b/appveyor/scripts/setSconsArgs.ps1 @@ -15,6 +15,8 @@ if(!$env:APPVEYOR_PULL_REQUEST_NUMBER) { $sconsArgs += " certFile=appveyor\authenticode.pfx certTimestampServer=http://timestamp.digicert.com" } $sconsArgs += " version_build=$env:APPVEYOR_BUILD_NUMBER" +# Use only 1 concurrent job when building +$sconsArgs += "-j1" # We use cmd to run scons because PowerShell throws exceptions if warnings get dumped to stderr. # It's possible to work around this, but the workarounds have annoying side effects. Set-AppveyorBuildVariable "sconsOutTargets" $sconsOutTargets diff --git a/sconstruct b/sconstruct index 03183c78f52..9fbce6da25a 100755 --- a/sconstruct +++ b/sconstruct @@ -127,7 +127,8 @@ env.Decider('MD5-timestamp') # Make sure to run the build on multiple threads so it runs faster env.SetOption('num_jobs', multiprocessing.cpu_count()) -print(f"Building using {env.GetOption('num_jobs')} jobs") +realNumJobs = env.GetOption('num_jobs') +print(f"Building using {realNumJobs} job{'s' if realNumJobs != 1 else ''}") #Make our recursiveCopy function available to any script using this environment env.AddMethod(recursiveCopy) From f4daf3d3d28acd08621fb56cedc87783bda31b49 Mon Sep 17 00:00:00 2001 From: Leonard de Ruijter Date: Thu, 13 Jan 2022 20:08:49 +0100 Subject: [PATCH 3/4] Add a space --- appveyor/scripts/setSconsArgs.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor/scripts/setSconsArgs.ps1 b/appveyor/scripts/setSconsArgs.ps1 index 55bc9ae5812..397abeb1761 100644 --- a/appveyor/scripts/setSconsArgs.ps1 +++ b/appveyor/scripts/setSconsArgs.ps1 @@ -16,7 +16,7 @@ if(!$env:APPVEYOR_PULL_REQUEST_NUMBER) { } $sconsArgs += " version_build=$env:APPVEYOR_BUILD_NUMBER" # Use only 1 concurrent job when building -$sconsArgs += "-j1" +$sconsArgs += " -j1" # We use cmd to run scons because PowerShell throws exceptions if warnings get dumped to stderr. # It's possible to work around this, but the workarounds have annoying side effects. Set-AppveyorBuildVariable "sconsOutTargets" $sconsOutTargets From 8bf74cf87cc6e975ac0c7310c2055ab5892bbc5f Mon Sep 17 00:00:00 2001 From: buddsean Date: Fri, 14 Jan 2022 09:41:17 +1100 Subject: [PATCH 4/4] update changes --- user_docs/en/changes.t2t | 2 ++ 1 file changed, 2 insertions(+) diff --git a/user_docs/en/changes.t2t b/user_docs/en/changes.t2t index e0ebe69e087..1617cb567f3 100644 --- a/user_docs/en/changes.t2t +++ b/user_docs/en/changes.t2t @@ -92,6 +92,8 @@ This ensures code will honor the Windows user setting for swapping the primary m - ``LOCALE_SLANGUAGE``, ``LOCALE_SLIST`` and ``LOCALE_SLANGDISPLAYNAME`` are removed from ``languageHandler`` - use members of ``languageHandler.LOCALE`` instead. (#12753) - 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) - ``winVersion.WIN10_RELEASE_NAME_TO_BUILDS`` is removed. (#13211) +- SCons now builds with multiple concurrent jobs, equal to the number of logical processors in the system. +This can dramatically decrease build times on multi core systems. (#13226) -