in reply to Same code, same data, different execution times?
That's a 60x difference, which seems way more than can be accounted for by considering things like whether the file is in the OS's disk cache.
Depending on system load and contention for memory, your approach of reading the entire file into memory may be working against you. Given the pattern you're looking for, you could just as easily scan a line-at-a-time, which would keep the CGI's footprint small.
|
|---|