Re: File Write Operation Slows to a Crawl....
| From: | Shawn McKenzie | Date: | Tue, 24 Feb 2009 19:30:08 +0000 |
| Subject: | Re: File Write Operation Slows to a Crawl.... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-288745@lists.php.net to get a copy of this message | ||
Jochem Maas wrote:
> I read that you already got your script performance up,
> but I'd still like to suggest that you shouldn't be reading in
> a complete 18Mb file (especially given that you don't know
> in advance whether some day(s) this size might be much larger).
>
> instead you should be opening a handle to the file and then
> read in, parse, & write out the parse results one line at a time.
>
> to get an idea of what I mean take a good look at this page of the manual:
>
> http://php.net/manual/en/function.fgets.php
>
Or even better, as I've read that it's much faster: stream_get_line()
--
Thanks!
-Shawn
http://www.spidean.com