I noticed that it took a very long time to to enter a foreach loop with a
fileset for one of my scripts so I took a look at the code that was
interacting with the System.IO namespace. I suspected that use of
DirectoryInfo and FileInfo object was causing the issue. Using the GetFiles
and GetDirectories methods on the DirectoryInfo class is a performance
problem. Either calling out to win32 libs or the static methods on
Directory are a better way to go. In the Class DirectoryScanner's method
ScanDirectory was were all the interaction with DirectoryInfo was happening.
I created a test script:
<target name="test">
<property name="ProductDirectory"
value="C:\Projects\dod.ahlta\Current\Product"/>
<fileset id="ProjectFiles">
<include name="${ProductDirectory}\**\*.*proj"/>
</fileset>
<echo message="dod.ahlta has ${fileset::file-count('ProjectFiles')}
projects."/>
</target>
Before I switched all calls to the static Directory class the time to
complete this script was *16+ seconds*. After the switch it completed in
*3+ seconds*.
--
Jay Flowers
----------------------------------------------------------------------
http://jayflowers.com
---------------------------------------------------------------------
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
nant-developers mailing list
nant-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-developers