| Logan Shaw 2006-04-27, 7:55 am |
| vitalyt@gmail.com wrote:
> Hi,
> I have cpp file which consist nested templates. Compilation time
> without optimization is 1-2 minutes, with -O2 turned on more then 5
> hours. Could anybody help with that problem?
> AIX 5.2, Visual Age C++ 6 compiler
>
> #include <pair>
> using namespace std;
> // value
> typedef
> std::pair
> <
> int,
> std::pair
> <
> int,
> std::pair
> <
> int,
> std::pair
> <
I have a hunch that the compiler tries all possible permutations of
some optimization related to nested templates, so that the running
time is an exponential function of the level of nesting of the
templates. I would try removing one level of nesting and see if it
takes about half as long. Or remove two levels and see if it takes
1/4 as long.
- Logan
|