Re: #19771 - patch
| From: | Yasuo Ohgaki | Date: | Fri, 18 Oct 2002 13:19:29 +0000 |
| Subject: | Re: #19771 - patch | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-89717@lists.php.net to get a copy of this message | ||
Tal Peer wrote:
hello, this patch tries to fix the performance issues described in bug #19771. i cannot benchmark this at the moment, so if anyone can, please do. the patch is available at http://tal.madcode.org/file.c.patch and thanks to wez :)Getting better, but it still too slow somehow... [yohgaki@dev DEV]$ ./sapi/cli/php t.php -------------------------------------------------------------------------
marker time index ex time perct-------------------------------------------------------------------------
Start 1034946698.39588300 - 0.00%-------------------------------------------------------------------------
fread 1034946698.41885300 0.022970080375671 4.36%-------------------------------------------------------------------------
file 1034946698.82063700 0.40178394317627 76.32%-------------------------------------------------------------------------
file_get_contents 1034946698.90671300 0.086076021194458 16.35%-------------------------------------------------------------------------
fgets 1034946698.92197300 0.015259981155396 2.90%-------------------------------------------------------------------------
Stop 1034946698.92232000 0.00034701824188232 0.07%-------------------------------------------------------------------------
total - 0.52643704414368 100.00%------------------------------------------------------------------------- [yohgaki@dev DEV]$ cat t.php <?php $filename = '/var/log/httpd/error_log.1'; require("Benchmark/Timer.php"); $time = new Benchmark_Timer; $time -> setMarker('Start'); $fp = fopen($filename,'r'); for ($i = 0; $i<100; $i++) $s = explode("\n", fread($fp, filesize($filename))); fclose($fp); $time -> setMarker('fread'); for ($i = 0; $i<100; $i++) $s = file($filename); $time -> setMarker('file'); for ($i = 0; $i<100; $i++) $s = file_get_contents($filename); $time -> setMarker('file_get_contents'); $fp = fopen($filename,'r'); for ($i = 0; $i<100; $i++) $s = explode("\n", fgets($fp,filesize($filename))); $time -> setMarker('fgets'); fclose($fp); $time -> setMarker('Stop'); $time -> display(); ?>