more info from what i've been looking at in CCTask.  I haven't tried this out yet,
but it's to give you an idea of what i was thinking.  Anyone have any comments?
 
 
New Interface:
public interface DependencyStrategy
{
    public void evaluateDependencies(CCTask task, Enumeration targets)
            throws Exception;
}
 
 
CCTask has new attribute:
 
    private Class dependencyStrategy =
            DependencyTableStrategy.class;
 
    public void setDependencyStrategy(String className)
    {
        try
        {
            Class c = Class.forName(className);
            if (DependencyStrategy.class.isAssignableFrom(c))
                dependencyStrategy = c;
            else
                throw new BuildException("DependencyStrategy must implement "
                    + DependencyStrategy.class.getName());
        }
        catch (ClassNotFoundException e)
        {
            throw new BuildException(e);
        }
    }
 
Dependency Analysis in CC task method checkForChangedIncludeFiles would be replaced
with:
 
            try
            {
                DependencyStrategy strategy =
                        (DependencyStrategy)dependencyStrategy.newInstance();
 
                strategy.evaluateDependencies(this, targets.elements());
            }
            catch (InstantiationException e)
            {
                throw new BuildException(e);
            }
            catch (IllegalAccessException e)
            {
                throw new BuildException(e);
            }
            catch (Exception e)
            {
                throw new BuildException(e);
            }
 
New class to do dependency evaluation using the DependencyTable
class:
 
public class DependencyTableStrategy
        implements DependencyStrategy
{
    public void evaluateDependencies(CCTask task,
                                     Enumeration targets)
            throws IOException
    {
        DependencyTable dependencyTable = new DependencyTable(task.getObjdir());
        try {
            dependencyTable.load();
        } catch (Exception ex) {
            task.log("Problem reading dependencies.xml: " + ex.toString());
        }
        while (targets.hasMoreElements()) {
            TargetInfo target = (TargetInfo) targets.nextElement();
            if (!target.getRebuild()) {
                if (dependencyTable
                    .needsRebuild(task, target, task.getDependencyDepth())) {
                    target.mustRebuild();
                }
            }
        }
 
        dependencyTable.commit(task);
    }
}
 
 
 

----------------
Matthew Inger [inger@synygy.com]
Software Developer
Synygy, Inc
610-664-7433 x 7770
"Man who jump off cliff, leap to conclusions." - Confucious

-----Original Message-----
From: Inger, Matthew [mailto:inger@Synygy.com]
Sent: Friday, August 29, 2003 2:01 PM
To: 'Helge Schulz'; Dominique Devienne
Cc: 'Curt Arnold'; ant-contrib-developers@lists.sourceforge.net; OpenSHORE development
Subject: RE: [Ant-contrib-developers] Re: Patch: cpptasks dependency analy sis up to 1000 times faster

I have a more interesting approach.  Strategy pattern ladies and
gentleman.  Create a DependencyAnalysisStrategy interface.
Supply the original dependency analysis as the default one, and
provide Helge's as an additional one.  Then the user could potentially
plug in his/her own strategy for dependency analysis:

public interface DependencyAnalysisStrategy {
   // Fill in interface here
}

public class DefaultDepAnalysisStrategy {
   // Fill in
}

public class EnhancedDepAnalysisStrategy {
   // Fill in
}


<cc ....
    dependencyanalysis="EnhancedDepAnalysisStrategy" />


Does this make sense?  That way people could pick and
choose when they wanted to use what strategy.


----------------
Matthew Inger [inger@synygy.com]
Software Developer
Synygy, Inc
610-664-7433 x 7770
"Man who jump off cliff, leap to conclusions." - Confucious


-----Original Message-----
From: Helge Schulz [mailto:Helge.Schulz@gmx.net]
Sent: Friday, August 29, 2003 1:23 PM
To: Dominique Devienne
Cc: 'Curt Arnold'; ant-contrib-developers@lists.sourceforge.net;
OpenSHORE development
Subject: [Ant-contrib-developers] Re: Patch: cpptasks dependency
analysis up to 1000 times faster


On Thu, 28 Aug 2003, Dominique Devienne wrote:
>
> This is what I've seen from applying the patch, in one of my projects,
> with 1569 .cpp, 1944 .h, 48 .hpp, so a good size project already, totaling
> 1,178,784 lines of code (including comments).
>
>                      First Full Analysis    Subsequent Analysis
> Official CppTasks:     63 seconds +/- 2       24 seconds +/- 1
> Patched  CppTasks:     61 seconds +/- 0       19 seconds +/- 1
>
> Note that this timing is the full build time, including Ant startup, and
> recursing the directory tree, since the projects is composed of 30+ libs,
> as well deciding that 423 Java files are up to date.
>
> Compare this to the full time to build (a few seconds taken by Java
> compile): 21 minutes 28 seconds.

OpenSHORE (http://sf.net/projects/openshore) has 321 .cpp, 419 .h and 249
.java source files. It has 210,571 lines of code (including comments).
Here are my timings for the whole project (27 C++ libs, without Java
translation):

                     First Full Analysis    Subsequent Analysis
Official CppTasks:    271 seconds +/- 2      268 seconds +/- 0
Patched  CppTasks:      7 seconds +/- 1        6 seconds +/- 0

Full rebuild (target shore-server): 9 minutes 57 seconds.

> So all in all, I'm seeing very little benefit from this myself.

Ok, but you have no slow down.

> The project I've tested the patch against is very mature, and has very
> few headers including unnecessary headers (forward prototyping of
> everything used as pointers/references).

Headers of OpenSHORE contains many C++ template implementations, so simple
forward declarations aren't possible.

> That's certainly not 1000 times faster :(

Better then slow down :-)

        Helge

--
Helge Schulz    http://www.openshore.org


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Ant-contrib-developers mailing list
Ant-contrib-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ant-contrib-developers