Hmm, not sure if anyone else tried this, but I wrote a quick Java class that
uses the FileInputStream class to read a file. I read a 126 meg file that
took about 700ms using CFFILE in CF5, but took around 2000ms using the
class I wrote.
Win 2K Pro, Athlon XP 1800+, 512 megs RAM, 40 gigs HD space. JDK 1.3.1_01
If anyone else wants to try:
Java class:
import java.io.*;
public class FileLoader {
FileInputStream fileInputStream;
byte[] fileStream = new byte[100000000];
int fileLength;
public FileLoader(String fileName) {
try {
fileInputStream = new FileInputStream("e:\\" + fileName);
fileLength = fileInputStream.available();
while (fileInputStream.available() > 0) {
fileInputStream.read(fileStream);
}
} catch(Exception e) {
System.out.println("An Error Occured.");
}
}
public int getFileLength() {
return fileLength;
}
public static void main(String args[]) {
FileLoader fileLoader = new FileLoader("dot net sdk.exe");
System.out.println(fileLoader.getFileLength());
}
}
CF Code:
<CFSET tickBegin = GetTickCount()>
<cffile action="READBINARY" file="E:\dot net SDK.exe" variable="test">
<CFSET tickEnd = GetTickCount()>
<CFSET loopTime = tickEnd - tickBegin>
<cfoutput>#len(test)#, #loopTime#</cfoutput>
<br>
<cfobject type="java" class="FileLoader" name="myObj" action="Create">
<CFSET tickBegin = GetTickCount()>
<cfset myObj.init("dot net sdk.exe")>
<CFSET tickEnd = GetTickCount()>
<CFSET loopTime = tickEnd - tickBegin>
<cfset test2 = myObj.getFileLength()>
<cfoutput>#test2#, #loopTime#</cfoutput>
> -----Original Message-----
> From: Jochem van Dieten [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 30, 2002 1:17 PM
> To: CF-Talk
> Subject: CF MX performance issue
>
>
> Could somebody who has CF MX on the same machine as some older version
> of CF test the script below for me? I find the results a bit disturbing
> at first sight (but maybe you see something wrong with the code).
>
> CF MX CF 4.5
> trusted cache no trusted cache
> no debugging debugging
> Duron 800 dual Athlon 1.2 GHz
> 1820 ms 150 ms
>
> Jochem
>
>
> <cfscript>
> // Put in the location of some document of about 25 KB.
> request.File = "";
>
> CRLF = chr(10);
> CurrentPosition = 72;
> </cfscript>
>
> <cffile action="READ" file="#request.file#" variable="temp"/>
>
> <cfscript>
> temp = ToBase64(temp);
> if (Len(temp) MOD 4 IS "1")
> temp = RemoveChars(temp, Len(temp) - 1, 1);
>
>
> request.StartTime = GetTickCount();
> while (CurrentPosition LTE Len(temp)) {
> temp = Insert(CRLF,temp,CurrentPosition);
> CurrentPosition = CurrentPosition + 72 + Len(CRLF);
> }
> WriteOutput(GetTickCount() - request.StartTime & " ms");
> </cfscript>
>
>
>
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists