![]() |
Speeding up C++ compile times
One downside of the new control system was the C++ toolchain change, which has much slower compile times than the previous tooling. It's at the point where we are considering switching to Java.
Are there tweaks that teams are using to improve compile times? |
Re: Speeding up C++ compile times
The toolchain is configured a little differently but it is the same compiler. Both Wind River Workbench (a feature rich custom Eclipse setup) and our new plain Eclipse setup use a cross version of gcc. So if you are seeing differences, it is most likely related to changes in CPU throughput, lower memory resources etc.
No way is it slower than Java. HTH |
Re: Speeding up C++ compile times
Quote:
-j enables multithreaded builds. Edit: oops. Depends on what IDE you're using. The -j flag works from command line. If building within eclipse, right the project, click properties, C/C++ build, behavior, enable parallel build. |
Re: Speeding up C++ compile times
Quote:
I use this method in my personal projects along with a 28 core 56 thread compiling/rendering server. It breezes through my game engine which is approximately 900000 lines of code so its still a baby engine but it takes quite some time to compile in single threaded mode. |
Re: Speeding up C++ compile times
Another way to speed up C++ compile times significantly is to set up compilation with precompiled headers. The way it basically works is you set up a new compilation unit designated as your precompiled header that will be used as a compilation checkpoint for all your other compilation units (typically .cpp files).
If you are unfamiliar with C++ compilation, for every compilation unit, the compiler needs to reparse every single header included throughout the include chain of that unit. If your system library headers are extensive (like for example windows.h can include hundreds of other headers) this can make compiling each unit take a long time. By including commonly included but infrequently changed headers into your precompiled header unit, you are giving the compiler a checkpoint at which to begin compilation for each other compilation unit so it doesn't have to reparse those headers that were included in your precompiled header. If you do have to change any of the headers included by your precompiled header, the entire project will need to be rebuilt. This is why you only want to include infrequently changed headers. You'll have to look up how to do this with the FRC C++ toolchain as I've only set it up with MSVC/VS, but the general process is the same. -Add a new .cpp that all it does is include a new .hpp. -In your new .hpp, include any headers that are commonly included (WPILib/STL headers are probably all you want to include). -Designate your new .cpp as the precompiled header compilation unit. -Include your new .h at the *very top* of all your existing .cpp files. |
| All times are GMT -5. The time now is 10:50 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi