Browse Source

Using Clang parallel compilation

Note regarding OpenSSL: With sources in different folder and lack of advanced rule in Borland makefile, it is not possible to use batch compilation with rule-based make file. Instead sources are explicitly (re)compiled in the library rule

Using 8 processes (higher number does not bring significant improvement)
Btw, so it was not true that Clang needs separate commandline for each file (see 17c5d4fa)

------
Timing statistics (times are the lowest out of few runs)

IDE WinSCP.cbproj recompile (i.e without thirdparty and components)
Classic     0:55
+PCH        0:39
Clang       2:53
+Batch      2:53
+OOP        2:56
+Batch+OOP  2:57
+B+OOP=2    1:51
+B+OOP=4    1:19
+B+OOP=8    1:05
+B+OOP=12   0:59
+B+OOP=16   1:00

thirdparty:
classic  2:35
clang    2:24
+8       0:49

build.bat:
classic 11:06
clang+8  8:38

Source commit: 1e073fb3df6a6f2c7f24de82d39fae6b1fc47367
Martin Prikryl 1 month ago
parent
commit
4ba8c00e0c

+ 12 - 4
libs/Makefile.inc

@@ -1,9 +1,17 @@
 CC = "$(BDS)\bin\bcc32c"
 MKLIB = "$(BDS)\bin\tlib" /a /C
-CFLAG_BASE = -cc1 -nobuiltininc -nostdsysteminc -triple i686-pc-windows-omf -emit-obj -mrelocation-model static -masm-verbose -mstack-alignment=16 -O2 -tM -tW -fborland-extensions
-CFLAG_BASE = $(CFLAG_BASE) -isystem "$(BDS)/include/windows/crtl" -isystem "$(BDS)/include/windows/sdk" -isystem "$(BDS)/include/dinkumware64"
-CFLAG_COMMON = $(CFLAG_BASE) -std=c99 -x c -fno-threadsafe-statics
-CFLAG_CPP = $(CFLAG_BASE) -x c++ -std=c++17 -fcxx-exceptions -ffunction-sections -fno-use-cxa-atexit
+
+CFLAG_BASE = \
+    -cc1 -nobuiltininc -nostdsysteminc -triple i686-pc-windows-omf -emit-obj -mrelocation-model static \
+    -masm-verbose -mstack-alignment=16 -O2 -tM -tW -fborland-extensions --jobs=8 \
+    -isystem "$(BDS)/include/windows/crtl" -isystem "$(BDS)/include/windows/sdk" \
+    -isystem "$(BDS)/include/dinkumware64"
+
+CFLAG_COMMON = \
+    $(CFLAG_BASE) -std=c99 -x c -fno-threadsafe-statics
+
+CFLAG_CPP = \
+    $(CFLAG_BASE) -x c++ -std=c++17 -fcxx-exceptions -ffunction-sections -fno-use-cxa-atexit
 
 # Debug:
 # CFLAG_CPP=$(CFLAG_CPP) -D_DEBUG -debug-info-kind=standalone

+ 1 - 1
libs/expat/bcb5/expat_static.mak

@@ -22,5 +22,5 @@ $(PROJECT): $(OBJFILES)
 # ---------------------------------------------------------------------------
 .path.c = ..\lib
 .c.obj:
-    $(CC) $(CFLAG1) -I$(INCLUDEPATH:;= -I) $(DEFINESARGS) -o $@ $<
+    $(CC) $(CFLAG1) -I$(INCLUDEPATH:;= -I) $(DEFINESARGS) -output-dir $(@D) {$< }
 # ---------------------------------------------------------------------------

+ 1 - 1
libs/libs3/Makefile

@@ -40,7 +40,7 @@ LIBS3_OBJS=\
     $(OBJ_D)\util.obj
 
 .c.obj:
-    $(CC) $(LIB_CFLAGS) -o $@ $<
+    $(CC) $(LIB_CFLAGS) -output-dir $(@D) {$< }
 
 $(O_LIBS3): $(LIBS3_OBJS)
     if exist $(O_LIBS3) del $(O_LIBS3)

+ 1 - 1
libs/mfc/source/borland.mak

@@ -50,7 +50,7 @@ BORFLAGS=$(CPPFLAGS) -I$(INCL:;= -I) -isystem "$(BDS)/include/windows/rtl"
 .path.obj = $(D)
 
 .cpp.obj:
-	$(CC) $(BORFLAGS) -o $@ $<
+	$(CC) $(BORFLAGS) -output-dir $(@D) {$< }
 
 #############################################################################
 # Goals to build

+ 1 - 1
libs/neon/Makefile.bcb

@@ -64,7 +64,7 @@ OBJFILES=\
 
 .path.c = $(SRC_D)/src
 .c.obj:
-    $(CC) $(LIB_CFLAGS) -o $@ $<
+    $(CC) $(LIB_CFLAGS) -output-dir $(@D) {$< }
 
 $(O_NEON): $(OBJFILES)
     if exist $(O_NEON) del $(O_NEON)

File diff suppressed because it is too large
+ 866 - 2552
libs/openssl/Makefile


+ 3 - 0
source/DScpComp.cbproj

@@ -45,6 +45,7 @@
         <_TCHARMapping>wchar_t</_TCHARMapping>
         <AllPackageLibs>rtl.lib;vcl.lib;vclx.lib</AllPackageLibs>
         <BCC_AllWarnings>true</BCC_AllWarnings>
+        <BCC_EnableBatchCompilation>true</BCC_EnableBatchCompilation>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
         <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
@@ -64,7 +65,9 @@
         <Multithreaded>true</Multithreaded>
         <OutputExt>bpl</OutputExt>
         <ProjectType>CppPackage</ProjectType>
+        <RunBCCOutOfProcess>true</RunBCCOutOfProcess>
         <SanitizedProjectName>DScpComp</SanitizedProjectName>
+        <SubProcessesNumber>8</SubProcessesNumber>
         <TLIB_PageSize>64</TLIB_PageSize>
         <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
         <VerInfo_Locale>1033</VerInfo_Locale>

+ 3 - 0
source/FileZilla.cbproj

@@ -30,6 +30,7 @@
     </PropertyGroup>
     <PropertyGroup Condition="'$(Base)'!=''">
         <_TCHARMapping>wchar_t</_TCHARMapping>
+        <BCC_EnableBatchCompilation>true</BCC_EnableBatchCompilation>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
         <BCC_PCHName_Clang>filezilla\FileZillaPCH.h</BCC_PCHName_Clang>
@@ -46,7 +47,9 @@
         <Multithreaded>true</Multithreaded>
         <OutputExt>lib</OutputExt>
         <ProjectType>CppStaticLibrary</ProjectType>
+        <RunBCCOutOfProcess>true</RunBCCOutOfProcess>
         <SanitizedProjectName>FileZilla</SanitizedProjectName>
+        <SubProcessesNumber>8</SubProcessesNumber>
         <TLIB_PageSize>128</TLIB_PageSize>
         <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
         <VerInfo_Locale>1033</VerInfo_Locale>

+ 3 - 0
source/Putty.cbproj

@@ -30,6 +30,7 @@
     </PropertyGroup>
     <PropertyGroup Condition="'$(Base)'!=''">
         <AllPackageLibs>rtl.lib</AllPackageLibs>
+        <BCC_EnableBatchCompilation>true</BCC_EnableBatchCompilation>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
         <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
@@ -44,7 +45,9 @@
         <Multithreaded>true</Multithreaded>
         <OutputExt>lib</OutputExt>
         <ProjectType>CppStaticLibrary</ProjectType>
+        <RunBCCOutOfProcess>true</RunBCCOutOfProcess>
         <SanitizedProjectName>Putty</SanitizedProjectName>
+        <SubProcessesNumber>8</SubProcessesNumber>
         <TLIB_PageSize>512</TLIB_PageSize>
         <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
         <VerInfo_Locale>1033</VerInfo_Locale>

+ 3 - 0
source/RScpComp.cbproj

@@ -32,6 +32,7 @@
         <_TCHARMapping>wchar_t</_TCHARMapping>
         <AllPackageLibs>vclx.lib;vcl.lib;rtl.lib;DriveDir.lib;My.lib;DragDropP.lib</AllPackageLibs>
         <BCC_AllWarnings>true</BCC_AllWarnings>
+        <BCC_EnableBatchCompilation>true</BCC_EnableBatchCompilation>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
         <BCC_UseClassicCompiler>false</BCC_UseClassicCompiler>
@@ -47,7 +48,9 @@
         <Multithreaded>true</Multithreaded>
         <OutputExt>lib</OutputExt>
         <ProjectType>CppStaticLibrary</ProjectType>
+        <RunBCCOutOfProcess>true</RunBCCOutOfProcess>
         <SanitizedProjectName>RScpComp</SanitizedProjectName>
+        <SubProcessesNumber>8</SubProcessesNumber>
         <TLIB_PageSize>64</TLIB_PageSize>
         <UsingDelphiRTL>true</UsingDelphiRTL>
         <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>

+ 3 - 0
source/ScpCore.cbproj

@@ -32,6 +32,7 @@
         <_TCHARMapping>wchar_t</_TCHARMapping>
         <AllPackageLibs>rtl.lib;vclx.lib;vcl.lib;xmlrtl.lib</AllPackageLibs>
         <BCC_AllWarnings>true</BCC_AllWarnings>
+        <BCC_EnableBatchCompilation>true</BCC_EnableBatchCompilation>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
         <BCC_PCHName_Clang>core\CorePCH.h</BCC_PCHName_Clang>
@@ -48,7 +49,9 @@
         <Multithreaded>true</Multithreaded>
         <OutputExt>lib</OutputExt>
         <ProjectType>CppStaticLibrary</ProjectType>
+        <RunBCCOutOfProcess>true</RunBCCOutOfProcess>
         <SanitizedProjectName>ScpCore</SanitizedProjectName>
+        <SubProcessesNumber>8</SubProcessesNumber>
         <TLIB_PageSize>512</TLIB_PageSize>
         <UsingDelphiRTL>true</UsingDelphiRTL>
         <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>

+ 3 - 0
source/ScpForms.cbproj

@@ -27,6 +27,7 @@
         <_TCHARMapping>wchar_t</_TCHARMapping>
         <AllPackageLibs>vcl.lib;rtl.lib;My.lib;vclx.lib;DriveDir.lib;DragDropP.lib;tb2k.lib;tbxp.lib;bcbie.lib;PngComponents.lib;xmlrtl.lib;vclactnband.lib;vclimg.lib;vclie.lib</AllPackageLibs>
         <BCC_AllWarnings>true</BCC_AllWarnings>
+        <BCC_EnableBatchCompilation>true</BCC_EnableBatchCompilation>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
         <BCC_PCHName_Clang>forms\FormsPCH.h</BCC_PCHName_Clang>
@@ -43,7 +44,9 @@
         <OutputExt>lib</OutputExt>
         <PackageImports>vcl.bpi;rtl.bpi;vclx.bpi;DragDrop.bpi;My.bpi;DriveDir.bpi;$(PackageImports)</PackageImports>
         <ProjectType>CppStaticLibrary</ProjectType>
+        <RunBCCOutOfProcess>true</RunBCCOutOfProcess>
         <SanitizedProjectName>ScpForms</SanitizedProjectName>
+        <SubProcessesNumber>8</SubProcessesNumber>
         <TLIB_PageSize>1024</TLIB_PageSize>
         <UsingDelphiRTL>true</UsingDelphiRTL>
         <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>

+ 3 - 0
source/ScpResources.cbproj

@@ -26,6 +26,7 @@
     <PropertyGroup Condition="'$(Base)'!=''">
         <_TCHARMapping>wchar_t</_TCHARMapping>
         <BCC_AllWarnings>true</BCC_AllWarnings>
+        <BCC_EnableBatchCompilation>true</BCC_EnableBatchCompilation>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
         <BCC_PCHName_Clang>forms\ResourcesPCH.h</BCC_PCHName_Clang>
@@ -40,7 +41,9 @@
         <Manifest_File>None</Manifest_File>
         <Multithreaded>true</Multithreaded>
         <ProjectType>CppStaticLibrary</ProjectType>
+        <RunBCCOutOfProcess>true</RunBCCOutOfProcess>
         <SanitizedProjectName>ScpResources</SanitizedProjectName>
+        <SubProcessesNumber>8</SubProcessesNumber>
         <TLIB_PageSize>64</TLIB_PageSize>
         <VerInfo_Locale>1033</VerInfo_Locale>
     </PropertyGroup>

+ 3 - 0
source/WinSCP.cbproj

@@ -52,6 +52,7 @@
         <_TCHARMapping>wchar_t</_TCHARMapping>
         <AllPackageLibs>vcl.lib;rtl.lib;vclx.lib;ws2_32.lib;secur32.lib;My.lib;DriveDir.lib;DragDropP.lib;tb2k.lib;tbxp.lib;bcbie.lib;Crypt32.lib;PngComponents.lib;xmlrtl.lib;vclactnband.lib;vclimg.lib;winhttp.lib;jcl.lib;vclie.lib;vcledge.lib;urlmon.lib;shlwapi.lib;powrprof.lib;soaprtl.lib;fmx.lib;dbrtl.lib;inet.lib;psapi.lib;msi.lib</AllPackageLibs>
         <BCC_AllWarnings>true</BCC_AllWarnings>
+        <BCC_EnableBatchCompilation>true</BCC_EnableBatchCompilation>
         <BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
         <BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
         <BCC_PCHName_Clang>windows\WinPCH.h</BCC_PCHName_Clang>
@@ -75,7 +76,9 @@
         <Multithreaded>true</Multithreaded>
         <OutputExt>exe</OutputExt>
         <ProjectType>CppVCLApplication</ProjectType>
+        <RunBCCOutOfProcess>true</RunBCCOutOfProcess>
         <SanitizedProjectName>WinSCP</SanitizedProjectName>
+        <SubProcessesNumber>8</SubProcessesNumber>
         <UsingDelphiRTL>true</UsingDelphiRTL>
         <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
         <VerInfo_Keys>CompanyName=Martin Prikryl;FileDescription=WinSCP: SFTP, FTP, WebDAV, S3 and SCP client;FileVersion=6.6.0.0;InternalName=winscp;LegalCopyright=(c) 2000-2025 Martin Prikryl;LegalTrademarks=;OriginalFilename=winscp.exe;ProductName=WinSCP;ProductVersion=6.6.0.0;ReleaseType=stable;WWW=https://winscp.net/</VerInfo_Keys>

Some files were not shown because too many files changed in this diff