You are here: Re: [PHP] Parsing a large file « PHP « IT news, forums, messages
Re: [PHP] Parsing a large file

Posted by "Richard Lynch" on 01/14/06 00:26

On Fri, January 13, 2006 3:33 pm, Jay Paulson wrote:
> $buf = "";

Probably better to initialize it to an empty array();...

> while (!feof($fhandle)) {
> $buf[] = fgets($fhandle);

.... since you are going to initialize it to an array here anyway.

> if ($i++ % 10 == 0) {

Buffering 10 lines of text in PHP is probably not going to make a
significant difference...

You'll have to test on your hardware to confirm, but between:

1. Low-level disk IDE buffer
2. Operating System disk cache buffers
3. C code of PHP source disk cache buffers

your PHP 10-line buffer in an array
is probably more overhead, and much more complicted code to maintain,
with no significant benefit.

--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация