Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-09-20 13:06:34


The paper summarized below, including graphs and source code has been
uploaded to:

http://groups.yahoo.com/group/boost/files/instantiation_speed/

You can see the full text by looking at index.html, but if you want the
embedded graphs, you'll need to download the .tgz file:

http://groups.yahoo.com/group/boost/files/instantiation_speed/instantiation_
speed.tgz

-Dave

-------------

Introduction

As C++ programmers begin to rely on template metaprogramming constructs[1]
for high performance computing, they often find that the time required to
compile their programs grows unacceptably. Because fast compiles are an
important part of an effective code/debug/test cycle, it becomes important
to optimize not only a program's runtime performance, but its compile-time
performance as well. This can be especially true in a research environment,
where it is important to be able to try out new ideas quickly.

Unfortunately, since the template instantiation mechanism of most compilers
is undocumented, it is far from clear which constructs will result in faster
compilation. Some things seem as though they should obviously improve
things, for example, reducing the number of distinct types generated, and
reducing the overall size of the names of those types. Beyond that, however,
most metaprogrammers are ``flying blind''. Some will go out of their way to
make ``optimizations'' which don't, in fact, produce the expected result.
During a large metaprogramming project, the authors repeatedly found
themselves faced with decisions about how to structure their program for
compilation speed. This paper presents the results of a few experiments
which were able to help.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk