Performance of generators on Windows is suboptimal
Both the Ninja and VS generators are very slow on Windows compared to Linux. For context, I have a project that takes 25ish seconds to configure and nearly 1 minute to generate VS solutions (total 1:25). For Ninja it takes 25 seconds to generate (total: 50s). There are three pieces of low hanging fruit for performance here. For Ninja, almost all the runtime is due to GetCasePathName
. This is a known issue, #20214.
This is also a problem for the VS generator, and costs almost 5 seconds for our project. Another issue is in CheckManagedType
, which loops over every file in every target to find any C# files. In our project, it seems to do this at least a dozen times per target. Caching this value gets us back another 5 seconds of runtime. The final issue is in GuessLibrarySOName
, which attempts to perform ELF parsing that is unnecessary on Windows. Disabling this gets us another 5 seconds of runtime.
I have patches available for all 3 of these and will be putting up a MR shortly, but even with these the best I manage to get for VS is one minute configure+generate (35 seconds generate). This is still slower than I would like, and I would like to use this issue to track my efforts to hunt down further optimization opportunities. My current targets of optimization will likely be caching system call results and multithreading some filesystem io.