tricks to organize code for faster compile

G

Greger

Dear all,
what do you people use for organising code for optimal compile time?
I have an app , gui + core + file ops, which is growing and compile time is
too long, need a better way of organising the code. Could someone please
highlight what could be done to speed up compile time, tia.
Greger
 
V

Victor Bazarov

Greger said:
what do you people use for organising code for optimal compile time?

The simplest "trick" I use is forward-declaring all that can be instead
of defining.
I have an app , gui + core + file ops, which is growing and compile
time is too long, need a better way of organising the code. Could
someone please highlight what could be done to speed up compile time,
tia.

Splitting your code into components and building them separately should
also help. See John Lakos' "Large-Scale C++ Software Design" for more
information on separating your code into components.

V
 
M

Mirek Fidler

Greger said:
Dear all,
what do you people use for organising code for optimal compile time?
I have an app , gui + core + file ops, which is growing and compile time is
too long, need a better way of organising the code. Could someone please
highlight what could be done to speed up compile time, tia.
Greger

U++ (upp.sf.net) provides build technology (blitz-build) that in most
cases reduces build time 4-8 times.

It works by grouping .cpp files together and compiling them as single
unit. This way included files are processed just once. As C++ compiler
spends most time parsing headers (usually it is hunderds of thousands .h
lines and thousands of .cpp lines), compile time reductions are really
dramatic.

Of course, it needs more magic to work than can be explained in a single
post :)

Mirek
 
B

Bob Hairgrove

Dear all,
what do you people use for organising code for optimal compile time?
I have an app , gui + core + file ops, which is growing and compile time is
too long, need a better way of organising the code. Could someone please
highlight what could be done to speed up compile time, tia.
Greger

What Victor and Mirek said, but also use precompiled headers if you
can.
 
J

Joe Hotchkiss

Greger said:
Dear all,
what do you people use for organising code for optimal compile time?
I have an app , gui + core + file ops, which is growing and compile time is
too long, need a better way of organising the code. Could someone please
highlight what could be done to speed up compile time, tia.

Avoid networked drives, especially for intermediate files.

--
Regards,

Joe Hotchkiss,
http://joe.hotchkiss.com
http://harrowsubaqua.org.uk

XXXXXXXXXXXXXXXXXXXXXXXXX
X joe.hotchkiss X
X at selex-sas.com X
XXXXXXXXXXXXXXXXXXXXXXXXX
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top