ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoine Levy-Lambert" <anto...@antbuild.com>
Subject Re: cvs commit: ant/src/testcases/org/apache/tools/ant DirectoryScannerTest.java
Date Mon, 21 Jul 2003 17:05:07 GMT
> Your getCanonicalPath fix will not catch the situation for any OS
> other than Windows (the way it is coded right now).  It will also slow
> down scanning considerably, probably to the point that your prior
> optimization gets undone.  And it would probably break in the presence
> of symbolic links if we applied it to OSes that support them.
>

I would like to give figures of time needed to do a scan for 2 filesets
which have different characteristics relative to the optimization of
DirectoryScanner (use of include patterns to restrict the scanning when the
include patterns do not start with wildcards)

One example (extreme) of performance change between

Ant nightly July 10th    : 144 milliseconds

CVS Head                  : 39 milliseconds

to scan the following fileset :

<fileset id="myfileset" dir="c:/">
 <include
name="Programme/cygwin/usr/local/lib/xemacs-21.4.13/i686-pc-cygwin/include/m
"/>
</fileset>

One :( example for a more classical fileset :

<fileset id="myfileset2" dir="c:/dev/asf/ant/src/main">
<include name="**/*.java"/>
</fileset>

Ant nightly July 10th    : 380 milliseconds

CVS Head                  : 389 milliseconds

----------------------------------------------------------------------------
-----------------------
Figures of File.getCanonicalFile

110 milliseconds to do this 100 times:
File f = new
File("C:/Programme/cygwin/usr/local/lib/xemacs-21.4.13/i686-pc-cygwin/includ
e/m");
            try {
            File g = f.getCanonicalFile();
            }
            catch (Exception e) {}

----------------------------------------------------------------------------
------------------------------
build file snippet to measure scanning performance :
<project name="testzip" basedir=".">
<fileset id="myfileset" dir="c:/">
<include
name="Programme/cygwin/usr/local/lib/xemacs-21.4.13/i686-pc-cygwin/include/m
"/>
</fileset>
<fileset id="myfileset2" dir="c:/dev/asf/ant/src/main">
<include name="**/*.java"/>
</fileset>
<target name="test2">
  <script language="javascript"> <![CDATA[
     importClass(java.util.GregorianCalendar);
     importClass(java.lang.Long);
     importClass(java.lang.System);
    importPackage(Packages.org.apache.tools.ant.types);
    importPackage(Packages.org.apache.tools.ant);
     var letime;
     letime=new GregorianCalendar();
     var beforet;
     beforet= letime.getTimeInMillis();
     project.setNewProperty("beforet", Long.toString(beforet));
     for (i=0;i<10;i++) {

             a=new FileSet();
             r = new Reference();

             r.setRefId("myfileset2");
              a.setRefid(r);
             rs =   a.getDirectoryScanner(project);

     }
     aftert = new GregorianCalendar().getTimeInMillis();
     project.setNewProperty("aftert", Long.toString(aftert));
     elapsed =  aftert - beforet;
     project.setProperty("elapsed", Long.toString(elapsed));
        ]]> </script>
<echo>
before  : ${beforet}
after   : ${aftert}
elapsed : ${elapsed}
</echo>

</target>
</project>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message