C++ PATCH: PR 20599 (1/3)

Doug Gregor doug.gregor@gmail.com
Thu Sep 14 18:04:00 GMT 2006


On 9/13/06, Douglas Gregor <doug.gregor@gmail.com> wrote:
> Several of the facilities in the C++ Library TR1 just can't be
> implemented well without variadic templates. Our current
> implementation uses some disgusting, barely-maintainable preprocessor
> metaprogramming to give a poor approximation of these libraries.
> Variadic templates will help us improve compile times, simplify the
> code, and provide a more flexible TR1 implementation than any other
> compiler can.

More motivation for variadic templates is attached. This chart shows
the compilation times for a simple program that includes all of the
function objects and tuples parts of libstdc++'s TR1. We vary the
maximum number of supported arguments from 3 to 40 (libstdc++
currently supports a maximum of 10), using evil preprocessor tricks.

I meant to go up to 100 arguments supported, but I run out of memory
on my Mac (that has 3.5MB RAM).

I do not have the complete variadic templates implementation to
compare against, but it should be faster than the 3-argument version
(under 1 second).

  Cheers,
  Doug
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ct_performance.png
Type: image/png
Size: 26686 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20060914/0b033dd9/attachment.png>


More information about the Libstdc++ mailing list