Boost logo

Boost :

From: Jonathan de Halleux (dehalleux_at_[hidden])
Date: 2003-10-17 05:13:51

Yes of course,

Here's another idea on the subject:

Suppose you have a C++ parser on hand (using Spirit for instance) so you
could parse the files and create a dependency (directed) graph using the
BGL. In this graph, the files are the nodes and the edges are the #include.
(this problem is so important that it is one of the BGL examples). (Doxygen
already does that)

 From there, a lot could be done using graph theory. For instance:

    - by sorting the nodes by edges number, you can detect which files are
the most often included. In boost, I suppose it would be <boost/config.hpp>
    - since making forward declaration enables to break some edges, could
this algorithm be used to find which dependency could be replaced by a
forward declaration ?

Just thoughts.

At 11:51 17/10/2003 +0200, you wrote:
>Dear boosters,
>Although I'm currently working on the SMART_ASSERT library, I'm willing to
>stop for a little, and follow this idea.
>When it hit me, I couldn't believe its simplicity, and think it would be
>quite useful for a lot of projects.
>*** Fighting compilation times ***
>This issue appears more and more, even if computers/ compilers are getting
>faster, mostly due to templates, but not limited to (also, see Eric
>Niebler's latest article on CUJ).
>I'm working on a (huge) application, which contains 6 projects, each taking
>more than 5 mins. to compile. That wouldn't be a problem, but modifying
>something triggers a lot of source files to be recompiled.
>What I want to know is ***where*** should I minimize dependencies (based on
>the old mighty: don't optimize too soon strategy).
>So, what can be done, is to have a small utility header file included in ALL
>compilable files from your custom project (the files that you or your
>company own and can modify).
>This would be something similar to this:
>#define COMPILE_FILE __FILE__
>#include "boost/compile_profiler.hpp"
>(a script to include this in every file from your project I assume is quite
>easy to do).
>The compile_profiler.hpp will contain amongst others, something similar to
>namespace {
> some_class var( __DATE__, __TIME__, COMPILE_FILE);
>This will allow for:
>Throughout two consecutive compilations, you will know EXACTLY which files
>got recompiled (and eventually, dependencies). This is then used to create a
>database of such changes (this can also be improved, to contain the names of
>the classes/ functions that were modified, etc.).
>A program will then be created that will analyze this database, and in time,
>it can suggest to you ***where*** you should minimize dependencies.
>I think this would be very valuable for large projects.
>So, any interest in such a library?
>(note: I'll be off from tomorrow, until Tue or Wed - I'm moving to a new
>John Torjo
>-- "Practical C++" column writer for
>Freelancer, C++ consultant
>Unsubscribe & other changes:

Jonathan de Halleux, Research Assistant
Center for Systems Engineering and Applied Mechanics (CESAME)
Universite catholique de Louvain
Batiment Euler , Av. Georges Lemaitre, 4 Tel : +32-10-47 2595
B-1348 Louvain-la-Neuve Belgium
E-mail : dehalleux_at_[hidden]

Boost list run by bdawes at, gregod at, cpdaniel at, john at