[Scons-users] SCons very slow on GitHub actions
Leonard de Ruijter
alderuijter at gmail.com
Thu May 1 12:53:14 EDT 2025
Dear Joseph,
Thanks for your extensive breakdown of the process.
I have tried running cvarsall64.bat outside scons. Invocation of that
takes approximately 5 seconds. I tried running vswhere earlier but
without arguments, that's definitely smooth enough.
Initializing an environment with tools=[] is fast, with tools=["msvc"]
is slow. So we at least know for sure what tool is causing the delay.
Regards,
Leonard
On 5/1/2025 4:20 PM, Joseph C. Brill wrote:
>
> There are a significant number of IO reads of the OS drive file system
> for MSVC batch file invocations and SCons MSVC initialization.
>
> In general, modern MSVC batch file invocations are “expensive”.
>
> It wouldn’t hurt to add the following to your build environment:
>
> set VSCMD_SKIP_SENDTELEMETRY=1
>
> If nothing else, this may skip a powershell invocation to setup
> sending telemetry.
>
> After a brief look at the SConstructs in the SCons example, OSARA, and
> NVDA projects, I believe that the number of MSVC batch file
> invocations on an amd64 box for each is likely:
>
> * 1: SCons example (0 default environments and 1 user environment)
> * 2: OSARA (0 default environments and 2 user environments)
> * 4: NVDA (1 default environment and 3 user environments)
>
> What follows is a high-level description of how MSVC is initialized.
> Errors are possible. It may be easier to discuss in an SCons discussion.
>
> Simplified steps for MSVC initialization:
>
> * Find the location of the vswhere executable
> * Invoke vswhere
> * For each version of MSVC detected:
> o Check for the existence of a set of required compiler files
> * For each Environment() unique combination of MSVC instance and
> arguments:
> o Call the MSVC batch file to configure environment
>
> Vswhere uses a “%ProgramData%” subdirectory (OS drive) to load the
> COM server and possibly read data.
>
> Calling the 2022 MSVC batch file to configure the environment entails
> (local configuration):
>
> * 17 or more batch file invocations
> * 1 vswhere.exe invocation
> * 0 or 1 powershell invocations to setup telemetry
> ("%VSCMD_SKIP_SENDTELEMETRY%"=="")
>
> MSVC batch files may perform any of the following zero of more times:
>
> * Check for the existence of directories and/or files
> * Use the “where” command to search the system path
> * Query the registry
> * Change directories (cd/push/pop)
> * File read
>
> The MSVC batch file skeleton call sequence below is for an amd64 box
> with HOST_ARCH=”amd64” and TARGET_ARCH=”amd64”.
>
> C:\Program Files\Microsoft Visual
> Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat:
>
> ·"%~dp0vcvarsall.bat" x64 %*
>
> o"%~dp0..\..\..\Common7\Tools\vsdevcmd.bat"
> §"%~dp0vsdevcmd\core\vsdevcmd_start.bat"
> ·"%~dp0parse_cmd.bat" %*
> §vswhere.exe
> §"%VS170COMNTOOLS%VsDevCmd\core\dotnet.bat"
> ·Reg queries
> §"%VS170COMNTOOLS%VsDevCmd\core\msbuild.bat"
> ·Path existence
> ·Where
> §"%VS170COMNTOOLS%VsDevCmd\core\winsdk.bat"
> ·Reg queries
> ·Paths existence
> §"%VS170COMNTOOLS%vsdevcmd\ext\ConnectionManagerExe.bat"
> ·Path existence
> ·Where
> §"%VS170COMNTOOLS%vsdevcmd\ext\diaghub.bat"
> ·Where
> §"%VS170COMNTOOLS%vsdevcmd\ext\html_help.bat"
> ·Path existence
> ·Where
> §"%VS170COMNTOOLS%vsdevcmd\ext\netfxsdk.bat"
> ·Reg queries
> ·Path existence
> ·Where
> §"%VS170COMNTOOLS%vsdevcmd\ext\perf_tools.bat"
> ·Reg queries
> ·Path existence
> ·Where
> §"%VS170COMNTOOLS%vsdevcmd\ext\roslyn.bat"
> ·Where
> §"%VS170COMNTOOLS%vsdevcmd\ext\team_explorer.bat"
> ·Path existence
> ·Where
> §"%VS170COMNTOOLS%vsdevcmd\ext\testwindow.bat"
> ·Path existence
> ·Where
> §"%VS170COMNTOOLS%vsdevcmd\ext\vcvars.bat"
> ·Path existence
> ·Dir contents
> ·Where
> ·File read
> §if "%VSCMD_SKIP_SENDTELEMETRY%"==""
> ·Powershell Send Telemetry
> §"%~dp0vsdevcmd\core\vsdevcmd_end.bat"
> ·Possible directory changes
>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20250501/239d1fb6/attachment-0001.htm>
More information about the Scons-users
mailing list