Where do I report issues with CFMX to Macromedia?  I know I'm not the first
to discover this, but cfdirectory is extremely inefficient when dealing with
large directories.  I don't know if this is a problem with J2EE platform
that CFMX runs on top of or what, but it shouldn't take several seconds to
do a cfdirectory where I'm pulling only one file back, even if the directory
has a 100,000+ files in it.   It seems like cfdirectory loads the entire
directory contents into memory and then applies the filter.

Below is some sample code if anyone wants to see what I'm talking about.

-Nelson

<!--- Create a bunch of files --->
<cfset vDir = "d:\test">
<cfset NumberOfFilesToCreate = 100000>

<cfif NOT DirectoryExists(vDir)>
    <cfdirectory action="" directory="#vDir#">
</cfif>

<cfloop from="1" to="#NumberOfFilesToCreate#" index="i">
<cffile action="" file="#vDir#\z#i#.txt" output="This is file number
#i#.">
</cfloop>

<!--- Get File Info --->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body>
<cfset start = GetTickCount()>
<cfset tmp = Randomize(right(start, 8))>
<cfset fileIndex = RandRange(1, 1000000)>
<cfif FileExists("#vDir#\z#fileIndex#.txt")>
<cfdirectory action="" directory="#vDir#" name="dirTest"
filter="z#fileIndex#.txt" >
<cfdump var="#dirTest#">
<cfoutput>@#fileContents#@</cfoutput>
<cfelse>
<cfoutput>File not found.</cfoutput>
</cfif>
<hr>Processing Time: <cfoutput>#GetTickCount()-Start#</cfoutput>
</body>
</html>




[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to