#19971 [Fbk->Opn]: file() function extremally slow

From: Date: Fri, 18 Oct 2002 09:11:52 +0000
Subject: #19971 [Fbk->Opn]: file() function extremally slow
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-22751@lists.php.net to get a copy of this message
ID: 19971 User updated by: sazonenkov@yandex.ru Reported By: sazonenkov@yandex.ru -Status: Feedback +Status: Open Bug Type: *Directory/Filesystem functions Operating System: win_xp PHP Version: 4.2.3 New Comment: It slow even with text files Sorry for Photoshop.exe-example I test it even with apache/logs/access.log Previous Comments: ------------------------------------------------------------------------ [2002-10-18 03:53:15] wez@php.net file() is not binary safe; you should not use it on binary files. When testing the snapshot, try the new file_get_contents() function too, which is 100% binary safe. $s = file_get_contents(); ------------------------------------------------------------------------ [2002-10-18 03:05:02] mfischer@php.net Please try using this CVS snapshot: http://snaps.php.net/php4-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-latest.zip Ops, wrong quick fix. ------------------------------------------------------------------------ [2002-10-18 03:04:43] mfischer@php.net Thank you for taking the time to report a problem with PHP. Unfortunately you are not using a current version of PHP -- the problem might already be fixed. Please download a new PHP version from http://www.php.net/downloads.php If you are able to reproduce the bug with one of the latest versions of PHP, please change the PHP version on this bug report to the version you tested and change the status back to "Open". Again, thank you for your continued support of PHP. ------------------------------------------------------------------------ [2002-10-18 02:48:08] sazonenkov@yandex.ru This function is extrimally slow read a file. On php4.0.4pl1 it much faster (about 100-1000x)!!! :( <?php require("Benchmark/Timer.php"); $time = new Benchmark_Timer; $time -> setMarker('Start'); $fp = fopen("Photoshop.exe", "r"); //$s = explode("\n", fread($fp, filesize("Photoshop.exe") ) ) ; fclose($fp); //print_r($s); $time -> setMarker('fread'); $s = file("Photoshop.exe"); $time -> setMarker('file'); $time -> setMarker('Stop'); $time -> display(); ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19971&edit=1

« previous php.bugs (#22751) next »