Go to Post I think this just hit the nail in the head with a sledgehammer. - Yan Wang [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 09-18-2015, 10:33 AM
MrRoboSteve MrRoboSteve is offline
Mentor
AKA: Steve Peterson
FRC #3081 (Kennedy RoboEagles)
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2011
Location: Bloomington, MN
Posts: 566
MrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond repute
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?
__________________
2016-17 events: 10000 Lakes Regional, Northern Lights Regional, FTC Burnsville Qualifying Tournament

2011 - present · FRC 3081 Kennedy RoboEagles mentor
2013 - present · event volunteer at 10000 Lakes Regional, Northern Lights Regional, North Star Regional, Lake Superior Regional, Minnesota State Tournament, PNW District 4 Glacier Peak, MN FTC, CMP
http://twitter.com/MrRoboSteve · www.linkedin.com/in/speterson
Reply With Quote
  #2   Spotlight this post!  
Unread 09-18-2015, 11:47 AM
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,168
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
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
__________________
Fast, cheap or working - pick any two!

Last edited by wireties : 09-18-2015 at 11:50 AM.
Reply With Quote
  #3   Spotlight this post!  
Unread 01-05-2016, 04:19 PM
kiettyyyy's Avatar
kiettyyyy kiettyyyy is offline
Registered User
FRC #1538 (The Holy Cows)
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2005
Location: San Diego, CA
Posts: 181
kiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond reputekiettyyyy has a reputation beyond repute
Send a message via AIM to kiettyyyy
Re: Speeding up C++ compile times

Quote:
Originally Posted by MrRoboSteve View Post
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?
Are you compiling using the -j flag?

-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.
__________________
-Kiet Chau

2004-2008 - Software Developer/Driver on Team #968
2008-2011 - Software Developer/Coach/Mentor/"Engineer" on Team #968
2011-Present - Mentor & Engineer on Team #1538
www.team1538.com

Last edited by kiettyyyy : 01-05-2016 at 04:22 PM. Reason: Forgot to show how to enable MT builds..
Reply With Quote
  #4   Spotlight this post!  
Unread 01-05-2016, 08:40 PM
tragic tragic is offline
Programming Mentor
FRC #4633 (Bobcats)
Team Role: Alumni
 
Join Date: Apr 2013
Rookie Year: 2013
Location: Calgary Alberta
Posts: 19
tragic is an unknown quantity at this point
Re: Speeding up C++ compile times

Quote:
Originally Posted by MrRoboSteve View Post
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?
Basically what @kiettyyyy said. Enabling parallel builds is a very simple way to drastically improve compile times. This has very good scaling as you go up in cores. So a high core count processor like an Intel i7-5820k where you have 12 logical cores (6 physical + 6 virtual) enables you to compile 12 different files of a project at the same time.

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.

Last edited by tragic : 01-05-2016 at 08:42 PM. Reason: Fixed an error.
Reply With Quote
  #5   Spotlight this post!  
Unread 01-06-2016, 08:51 AM
heuristics heuristics is offline
Registered User
FRC #3634
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2014
Location: Trumbull, CT
Posts: 21
heuristics is on a distinguished road
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.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:50 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi