Benchmark it both ways and see.
I benched this with a 100 MiB text file (largest I could find at short
notice). Buffer used for fread() calls was 2 KiB as above.
Values are averaged over 100 runs (I would have liked to do more, but I don't
have time). All values are to 4 significant figures.
Thought it might be interesting to see what happens by changing the buffer
size using the fread option. Hacked up your script to run 100 times for a
variety of buffer sizes reading in a ~100mb file, writing it out to
/dev/null. Each iteration would shuffle the buffer size array so that it
didn't them in various orders (just cause). This is on a FreeBSD 4.x box
800mhz, scsi disk, completely idle. Looks like for my server, 32K is the
fastest, but it also looks like it really doesn't matter much. And none
of this was run through apache which might have an affect since it's going
to cache data before sending it as well I expect.
BUFSIZE AVERAGE MIN MAX STDEV
1024 1.161640766 0.750351191 2.089925051 0.343560356
2048 1.192794297 0.749926805 2.099468946 0.352989462
4096 1.175014074 0.750481129 2.094204187 0.340703504
8192 1.191642218 0.750271797 2.103453875 0.342129591
16384 1.179281006 0.750427008 2.103821039 0.294178021
32768 1.112951536 0.750751972 2.096071959 0.280774437
65536 1.121285999 0.750077009 2.084055901 0.281509943
131072 1.223868408 0.750341177 2.114228964 0.376586171
262144 1.195006318 0.750770092 2.094146013 0.307552031
524288 1.247279932 0.75097084 2.878097057 0.405213182
1048576 1.162287986 0.752273083 2.099447012 0.328753411
2097152 1.170556216 0.752089024 2.101628065 0.298650593
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php