473,408 Members | 2,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Techniques to reduce template compile time

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

Nov 4 '07 #1
2 2608
On Nov 3, 4:08 pm, "PengYu...@gmail.com" <PengYu...@gmail.comwrote:
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.

Nov 5 '07 #2
"Pe*******@gmail.com" <Pe*******@gmail.comwrote in
news:11**********************@22g2000hsm.googlegro ups.com:
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
Nov 8 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: arch | last post by:
Hi, I am trying to implement a class hierarchy where there will be a base class defining the interface and some common operations (interface+implentation): Constraints : no STL. This will be...
6
by: Ben Ingram | last post by:
Hi all, I am writing a template matrix class in which the template parameters are the number of rows and number of columns. There are a number of reasons why this is an appropriate tradeoff for...
15
by: christopher diggins | last post by:
I have written an article on how to do Aspect Oriented Programming in vanilla C++ (i.e. without language extensions or other tools such as AspectC++). The article is available at...
1
by: suranap | last post by:
I am looking at some examples of template metaprogramming, but I'm not clear on some details of templates. In particular, what kinds of computations will be performed at compile-time? Is it only...
6
by: Hendrik Schober | last post by:
Hi, I have a problem with extending some existing code. In a simplified form, the problem looks like this: I have four types, A, B, C, and D. Each A refers to zero, one, or more B's and each...
5
by: Niklas Norrthon | last post by:
I've been banging my head in the wall for some time now over a little problem having to do with partial specialization of function templates. The real problem is more complex than this, but...
5
by: Wayne Shu | last post by:
Hi, guys I am reading Vandevoorde and Josuttis 's "C++ Template The Complete Guide" these days. When I read the chapter 15: Traits and Policy classes. I copy the code in 15.2.2 that use to...
4
by: nooneinparticular314159 | last post by:
I'm trying to understand template metaprogramming syntax. It's been years since I've touched C++, so this may actually be a C++ syntax issue (although it seems that the language has changed...
2
by: Clyde | last post by:
Hi, what i'm trying to do is: /////////////// Code Start template <class TType, int* p = 0> class Template { public:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.