QtCreator & Jom: Slow compile on a high-end desktop
-
Hi
I have bought new desktop with specs below to improve compile time.
Processor: Intel Sandy Bridge-E I7-3930K, 3.20GHz, 6 Cores, 12 Threads, 12MB Cache, 64bit, DDR3-1600MHz, Socket 2011
Memory: Corsair 16GB DDR3, 2133MHz
SSD Disk: Kingston 240GB SSDNow HyperX SATA 6.0Gb/sRunning on Windows 7 64bit, QtSDK 1.2.1 with Jom setup for build steps and MSVC 2010 x86 compiler. My project links against parts of Boost library (headers only), Qt libs are dynamically linked and I have only one main cpp file. Compile time is around 40s. I placed the whole project on RAM Disk but speed improved only by 1 sec. The CPU usage (all 6 cores combined) during compilation is ONLY 8%.
I expected much faster compile speed compared to Dual Core 1.8GHz, 1.5GB RAM machine. Is there anything I can configure to improve the speed? I suspect that the CPU is not really utilized.
Thanks
-
How many cpp files are there in total to be build?
-
-
[quote author="Tobias Hunger" date="1351863907"]How many cpp files are there in total to be build?[/quote]
It has only one cpp file, that is "main.cpp" with about 10000 lines. There are small project's header files and boost headers (.hpp) files. Qt lib DLLs are dynamically linked.
-
[quote author="ZapB" date="1351865052"]If you only have one cpp file then only one core will be used. Linking is still single threaded too I think. Try breaking your one large cpp file into smaller compilation units. That should speed up compilation but you will still be limited by link time.[/quote]
I was hoping that breaking the code into more cpp files will not be necessary :(
-
[quote author="Marcus Frenkel" date="1351874922"][quote author="ZapB" date="1351865052"]If you only have one cpp file then only one core will be used...[/quote]
Any workaround to make it work with single cpp file?
[/quote]
No, if you have only a single file AFAIK it has to be compiled in one run. You would need a special multi-threaded compiler. The best way to do so is having different modules which require only short compile runs each.
Jom basically starts several compiler instances in parallel. That brings the speed.
Moreover, you should really consider breaking up your code into several modules. The different makes are supporting to have partial compilation of the code by checking which files have been changed.
Without using jom you would have already a speedup of compilation. -
[quote author="koahnig" date="1351875981"][quote author="Marcus Frenkel" date="1351874922"][quote author="ZapB" date="1351865052"]If you only have one cpp file then only one core will be used...[/quote]
Any workaround to make it work with single cpp file?
[/quote]
No, if you have only a single file AFAIK it has to be compiled in one run. You would need a special multi-threaded compiler. The best way to do so is having different modules which require only short compile runs each.
Jom basically starts several compiler instances in parallel. That brings the speed.
Moreover, you should really consider breaking up your code into several modules. The different makes are supporting to have partial compilation of the code by checking which files have been changed.
Without using jom you would have already a speedup of compilation.
[/quote]I broke up the code into more CPP files. I found out that the most time consuming part is linking the boost library. So I couldn't get any improvement because it is only one class that uses the boost library (small code in my project but loads many boost's headers). I ended up using pre-compiled headers for boost and now the compile speed is good enough.