I'd wager CFDIRECTORY looks like something generally like this (in a
psuedo-CF/Java hybrid):

function getFileList(directory, filter) {
  List<File> fileList = directory.fileList(
    new FileFilter() {
      ... accept(File f) {
       return f matches filter;
      }
    }
  );
}

List<File> fileList = getFileList(new File(attributes.directory),
attributes.filter);

if (attributes.recurse) {
  for (File f in fileList) {
    if (f.isDirectory()) {
      fileList.addAll(getFileList(f, attributes.filter));
    }
  }
}

Query q = new Query("name,size,dateLastModified,...");

for (File f in fileList) {
  queryAddRow(q);
  querySetCell(q, "name", f.getName());
  ....
}

caller[attributes.name] = q;

As you can imagine, that's a LOT slower than a simple scan of the
directory.  In your case, it's greatly affected by the fact that
network files are handled differently than local files.  Specifically,
the filenames (which is all your Java used) are cached, but all the
nitty gritty (size, last mod date, etc) probably isn't, or at least
not as aggressively.  As such, getting that data is very expensive.
With all-local access you should still see a performance difference,
but it should be much smaller.

cheers,
barneyb

On 8/15/06, Brian Dumbledore <[EMAIL PROTECTED]> wrote:
> Here below is what I was running,
>
> <!--- this is a shared network drive, unix folder actually --->
> <cfset directoryname="\\jwoc\units\data\units">
>
> <cfset tstart=gettickcount()>
> <cfdirectory action="list" name="getinfo" directory="#directoryname#">
> <cfset tend=gettickcount()>
> <cfoutput>#(tend-tstart) * .001# seconds - #getinfo.recordcount# 
> records</cfoutput>
>
> <cfset tstart=gettickcount()>
> <cfset 
> thefiles=createobject("java","java.io.File").init("\\jwoc\units\data\units").list()>
> <cfset tend=gettickcount()>
> <cfoutput>#(tend-tstart) * .001# seconds - #ArrayLen(thefiles)# 
> records</cfoutput>
>
> And the output is:
>
> 79.342 seconds - 1462 records 1.078 seconds - 1462 records
>
> Such a difference in performance, I don't understand.. I know cfdirectory 
> brings lots more info than just the file name strings, but still I think it 
> is too much of a slowness issue. what do y'all think? How is cfdirectory 
> implemented?
>
-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 100 invites.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:249915
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to