GlobalNinjaGenerator: enlarge file stream buffer

This commit is contained in:
Clemens Wasser
2022-01-25 21:27:27 +01:00
parent 850bdc4203
commit bbdb000c55
2 changed files with 14 additions and 0 deletions
+13
View File
@@ -1021,6 +1021,19 @@ bool cmGlobalNinjaGenerator::OpenBuildFileStreams()
return false;
}
// New buffer size 8 MiB
constexpr auto buildFileStreamBufferSize = 8 * 1024 * 1024;
// Ensure the buffer is allocated
if (!this->BuildFileStreamBuffer) {
this->BuildFileStreamBuffer =
cm::make_unique<char[]>(buildFileStreamBufferSize);
}
// Enlarge the internal buffer of the `BuildFileStream`
this->BuildFileStream->rdbuf()->pubsetbuf(this->BuildFileStreamBuffer.get(),
buildFileStreamBufferSize);
// Write a comment about this file.
*this->BuildFileStream
<< "# This file contains all the build statements describing the\n"
+1
View File
@@ -526,6 +526,7 @@ private:
/// The file containing the build statement. (the relationship of the
/// compilation DAG).
std::unique_ptr<cmGeneratedFileStream> BuildFileStream;
std::unique_ptr<char[]> BuildFileStreamBuffer;
/// The file containing the rule statements. (The action attached to each
/// edge of the compilation DAG).
std::unique_ptr<cmGeneratedFileStream> RulesFileStream;