From 914a9eea94e4f46fe3743eef947fbad276c8f456 Mon Sep 17 00:00:00 2001 From: Eduard Voronkin <42834212+Noxybot@users.noreply.github.com> Date: Fri, 12 Sep 2025 23:08:47 -0700 Subject: [PATCH] FASTBuild: optimize generated file size Two optimizations here: 1. Remove non-mandatory aliases (I only used them for debugging). 2. Make objects lists' name shorter Both of those improvements contribute to the decrease of the FASTBuild DB file, since they are getting serialized. --- Source/cmFastbuildNormalTargetGenerator.cxx | 8 +++----- Source/cmGlobalFastbuildGenerator.cxx | 9 +++++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Source/cmFastbuildNormalTargetGenerator.cxx b/Source/cmFastbuildNormalTargetGenerator.cxx index 4a8bd2fbba..f413d3ccce 100644 --- a/Source/cmFastbuildNormalTargetGenerator.cxx +++ b/Source/cmFastbuildNormalTargetGenerator.cxx @@ -1307,8 +1307,7 @@ cmFastbuildNormalTargetGenerator::GenerateObjects() objectListNode); ComputePCH(*source, objectListNode, createdPCH); - objectListNode.Name = - cmStrCat(language, "_ObjectGroup_", GetTargetName()); + objectListNode.Name = cmStrCat(this->GetName(), '_', language, "_Objs"); // TODO: Ask cmake the output objects and group by extension instead // of doing this if (language == "RC") { @@ -1325,13 +1324,12 @@ cmFastbuildNormalTargetGenerator::GenerateObjects() } } - int groupNameCount = 1; + int groupNameCount = 0; for (auto& val : nodesPermutations) { auto& objectListNode = val.second; objectListNode.Name = - cmStrCat(objectListNode.Name, "-", objectListNode.CompilerOutputPath, - "-", std::to_string(groupNameCount++)); + cmStrCat(objectListNode.Name, "_", std::to_string(++groupNameCount)); LogMessage(cmStrCat("ObjectList name: ", objectListNode.Name)); } diff --git a/Source/cmGlobalFastbuildGenerator.cxx b/Source/cmGlobalFastbuildGenerator.cxx index a0eaaed8da..1d838732fb 100644 --- a/Source/cmGlobalFastbuildGenerator.cxx +++ b/Source/cmGlobalFastbuildGenerator.cxx @@ -1078,8 +1078,13 @@ void cmGlobalFastbuildGenerator::WriteExec(FastbuildExecNode const& Exec, } Indent(indent); *BuildFileStream << "}\n"; - WriteAlias(Exec.OutputsAlias); - WriteAlias(Exec.ByproductsAlias); + static bool const verbose = GlobalSettingIsOn(FASTBUILD_VERBOSE_GENERATOR) || + cmSystemTools::HasEnv(FASTBUILD_VERBOSE_GENERATOR); + // Those aliases are only used for troubleshooting the generated file. + if (verbose) { + WriteAlias(Exec.OutputsAlias); + WriteAlias(Exec.ByproductsAlias); + } } void cmGlobalFastbuildGenerator::WriteObjectList(