note 79161 deleted from function.md5-file by googleguy

From: Date: Tue, 22 Oct 2013 08:01:04 +0000
Subject: note 79161 deleted from function.md5-file by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-196726@lists.php.net to get a copy of this message
Note Submitter: glau dot stuff at N0_SPAM dot ridiculousprods dot com ---- It's much faster to call an 'exec' command to openssl md5 than to use md5_file. <?php $file_path = '/path/to/large/video_file.mov'; $begin = microtime(true); $hash = md5_file($file_path); $end = microtime(true) - $begin; echo "Hash = $hash; time = $end<br>"; # Hash = eac425a6f5b90f69e74710b015228640; time = 2.5333859920502 $begin = microtime(true); $result = split('=',exec("openssl md5 $file_path")); $end = microtime(true) - $begin; echo "Hash = ".$result[1]."; time = $end"; #Hash = eac425a6f5b90f69e74710b015228640; time = 0.79528999328613 ?> I consistently see about a 3x improvement in speed.

« previous php.notes (#196726) next »