Benchmark File_Passwd crypt_apr_md5()
| From: | bertrand Gugger | Date: | Thu, 10 Feb 2005 18:46:21 +0000 |
| Subject: | Benchmark File_Passwd crypt_apr_md5() | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-36133@lists.php.net to get a copy of this message | ||
Hi,
Sorry for the many messages,
want to open a new thread as the old is hijacked and became enormous.
I benched out the 2 versions of File_Passwd:
calculating and comparing 100 random length and content plaintexts.
the script: http://toggg.com/file_passwd/perf.phps.html
No return values differences so it's BC certainly.
Here the profiling on my poor P3-500 FC2:
+--------+-----------------+------------+------------+
| Method | Netto Time (ms) | Time (ms) | Percentage |
+--------+-----------------+------------+------------+
| Origin | 31,314.98 | 31,314.98 | 82.68 | | Ants | 6,371.73 | 6,371.73 | 16.82 | | Global | 188.37 | 37,875.09 | 100.00 |+--------+-----------------+------------+------------+ _Resource usage_ Array // 0=number of calls, 1=ru_utime, 2=ru_stime, 3=ru_minflt ( [Origin] => Array
(
[0] => 100
[1] => 30.928295
[2] => 0.015997
[3] => 211
)
[Ants] => Array
(
[0] => 100
[1] => 6.287044
[2] => 0.003
[3] => 9
)
)
ru for time give same ratio as Benchmark::Profiler().
Means 5 times quicker, but sure better on powerfull machines :(
I took this last Passwd.php.diff2 from ants to patch File/Passwd.php
You can find RUM on http://pear.php.net/pepr/pepr-proposal-show.php?id=189
à+
--
bertrand Gugger (toggg)
Ants Aasma wrote:
> Michael Wallner wrote:
>
>> <plug>
>> Well, sorry for jumping in, but would you mind looking at
>> File_Passwd::crypt_apr_md5()? ;-) That would definitly need some
>> reasonable optimization... it takes about .25s for one passwd.
>> </plug>
>
> Ok, here you go, diff against File_Passwd 1.1.2
> http://www.hot.ee/stepz/Passwd.php.diff
> Old one: 83ms
> New one: 8.3ms :)
> I could squeeze another 60% of performance out of it at 5.1ms by
> taking the version check out of the main loop, composing the md5
> argument inline and taking the concatenations out of the loop, but
> that looked godawful. You be the judge if the performance is worth the
> code readibility. Diff's @ http://www.hot.ee/stepz/Passwd.php.diff2