GlobalNinjaGenerator: WriteBuild is slow due to string buffering and encoding on Windows
As you can see from this trace the writes that happen inside of WriteBuild
are all buffered on Windows to around 4Kib.
This causes around 650 WriteFile
calls for only 2 files (compile_commands.json
and build.ninja
).
Also every write triggers expensive (and unnecessary) string encoding via MultiByteToWideChar
and WideCharToMultiByte
.
Why don't the Methods that get called in WriteObjectBuildStatements
all append to one single string buffer which then gets written out via only one WriteFile
call and without string encoding?