Мохнатые уроды и моральные пёзды. Войти !bnw Сегодня Клубы
php
К предыдущему посту. corey at effim dot com 09-Jun-2009 06:35 In my dev environment with a relatively low-speed drive (standard SATA 7200RPM) reading a 25MB zip file in 10 times... <?php $data = `cat /tmp/test.zip`; 1.05 seconds $fh = fopen('/tmp/test.zip', 'r'); $data = fread($fh, filesize('/tmp/test.zip')); fclose($fh); 1.31 seconds $data = file_get_contents('/tmp/test.zip'); 1.33 seconds ?> However, on a 21k text file running 100 iterations... <?php $data = `cat /tmp/test.txt`; 1.98 seconds $fh = fopen('/tmp/test.txt', 'r'); $data = fread($fh, filesize('/tmp/test.txt')); fclose($fh); 0.00082 seconds $data = file_get_contents('/tmp/test.txt'); 0.0069 seconds ?> Despite the comment about file_get_contents being faster do to memory mapping, file_get_contents is slowest in both of the above examples. If you need the best performance out of your production box, you might want to throw together a script to check out which method is fastest for what size files on that particular machine, then optimize your code to check the file size and use the appropriate function for it. NAHOOII?
#2CAM07 / @ileamare / 4412 дней назад

ipv6 ready BnW для ведрофона BnW на Реформале Викивач Котятки

Цоперайт © 2010-2016 @stiletto.