note 81751 added to function.md5-file
| From: | smartin at osu1 dot php dot net | Date: | Wed, 12 Mar 2008 12:58:42 +0000 |
| Subject: | note 81751 added to function.md5-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136967@lists.php.net to get a copy of this message | ||
In response to using exec instead for performance (Nov 13 2007 post), It looks like the performance
depends on the size of the file. See the results below using the same script from the original
post. The first hash is with md5_file and the second is with openssl md5.
With a 1MB file:
Hash = df1555ec0c2d7fcad3a03770f9aa238a; time = 0.005006
Hash = df1555ec0c2d7fcad3a03770f9aa238a; time = 0.01498
With a 2MB file:
Hash = 4387904830a4245a8ab767e5937d722c; time = 0.010393
Hash = 4387904830a4245a8ab767e5937d722c; time = 0.016691
With a 10MB file:
Hash = b89f948e98f3a113dc13fdbd3bdb17ef; time = 0.241907
Hash = b89f948e98f3a113dc13fdbd3bdb17ef; time = 0.037597
Performance seems to change proportionally with the file size. Judging from the previous
post's default file name (.mov) he/she was probably dealing with a large file. These are just
quick tests and far from a perfect benchmark, but you might want to test your own files before
assuming that the openssl solution is faster (ie, if working with small text files vs. movies, etc)
----
Server IP: 66.207.199.35
Probable Submitter: 206.191.21.204
----
Manual Page -- http://www.php.net/manual/en/function.md5-file.php
Edit -- https://master.php.net/note/edit/81751
Del: integrated -- https://master.php.net/note/delete/81751/integrated
Del: useless -- https://master.php.net/note/delete/81751/useless
Del: bad code -- https://master.php.net/note/delete/81751/bad+code
Del: spam -- https://master.php.net/note/delete/81751/spam
Del: non-english -- https://master.php.net/note/delete/81751/non-english
Del: in docs -- https://master.php.net/note/delete/81751/in+docs
Del: other reasons-- https://master.php.net/note/delete/81751
Reject -- https://master.php.net/note/reject/81751
Search -- https://master.php.net/manage/user-notes.php