Techniques to reduce template compile time

P

PengYu.UT

Hi,

One problem to use templates extensively is that it tends to take a
long time to compile. Other than changing to a different compiler, are
there any techniques to reduce the compile time?

Thanks,
Peng
 
W

webinfinite

Hi,

One problem to use templates extensively is that it tends to take a
long time to compile. Other than changing to a different compiler, are
there any techniques to reduce the compile time?

Thanks,
Peng

I think you have to wait.
 
P

Paavo Helde

Hi,

One problem to use templates extensively is that it tends to take a
long time to compile. Other than changing to a different compiler, are
there any techniques to reduce the compile time?

1. Precompiled headers - if your compiler supports precompiled headers, put
all template header includes into it and use it in all .cpp-s.

2. If your templates work on a limited number of types, put the actual
template definitions in .cpp files and add explicit template instantiations
for all needed types there. Might not work over dll/so boundaries.

3. Add more memory to your computer!
Thanks,
Peng

you are welcome!
Paavo
 

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
474,197
Messages
2,571,040
Members
47,634
Latest member
RonnyBoelk

Latest Threads

Top