> -----Original Message-----
> From: Martin Sebor [mailto:[EMAIL PROTECTED] On Behalf Of Martin Sebor
> Sent: Monday, June 30, 2008 10:51 PM
> To: dev@stdcxx.apache.org
> Subject: Re: implementation of Unary Traits
> 
> Travis Vitek wrote:
> >  
> [...]
> > If you ask what I prefer, I'm going to tell you I prefer the second
> > option (that is essentially what I wrote originally). But, 
> honestly, for
> > me to care either way, I need to know that there actually a 
> noticeable
> > performance difference between the two techniques.
> 
> FYI: I used gcc 4.3 and EDG eccp to measure the difference between
> the compilation times of each of the two approaches (i.e., using
> specialization vs using remove_cv).
> 
> In a program involving 10,000 invocations of is_void on distinct
> types, the specialization approach was 5 and 10 times faster than
> the one using remove_cv when using gcc and eccp, respectively. In
> the same program using only 1000 types, the specialization solution
> compiled 2 and 3 times faster, respectively.
> 
> With gcc, the compiler also required about half the amount of system
> memory to compile the specialization-based solution than the other
> one. (I didn't measure eccp memory usage).
> 
> This confirms that template metaprogramming is significantly more
> costly in terms of system resources than alternative approaches,
> at least in the gcc and eccp implementations. We should re-run the
> same tests with other compilers to get a complete picture.

That's not unexpected: like everything in computing, it's a tradeoff.

To get a really complete picture, you'd have to compare the
metaprogramming approach to the run-time alternatives.  I would expect
to see a corresponding speed increase and storage savings compared to
the runtime counterparts.

Brad.

Reply via email to