in reply to Re: Increase efficiency of script
in thread Increase efficiency of script

No, really, you guys are looking for optimization in the wrong place. How long does it take on your system for a Perl script to read a 250k text file line by line and print it line by line? Almost no time at all. I had to benchmark 100 iterations of that sort of routine just to measure a two-second execution time.

If a script, reading line by line 250k of data and outputting it via CGI, results in page loads in the order of "an eternity", there's definately a problem.

My guess is that your problem will be one of the following:

But I wouldn't be too quick to blame the segment of code that reads the file line by line and prints it; that's not doing anything that would take an eternity to execute.


Dave

Replies are listed 'Best First'.
Re^3: Increase efficiency of script
by bart (Canon) on Mar 20, 2004 at 17:43 UTC
    You're still forgetting one possible cause, davido. If a browser like the MSIE 5.x on the Mac, reads such a long file, it simply takes a long time to render. I'm almost sure that loading the 250k file from local disk may easily take 10 to 20 seconds, maybe even longer, before it shows up in the browser.

    Solution? Cut up the text in smaller pieces. People tend to prefer it that way.