Back to index

php5  5.3.10
bench.php
Go to the documentation of this file.
00001 <?php
00002 /* $Id: bench.php 201859 2005-12-02 01:59:48Z iliaa $ */
00003 
00004 /*
00005  This gives rather interesting results :)
00006  
00007  Measures on a Notebook P4M-1.7 256MB Windows 2000:
00008        sha1         0.556691
00009        tiger160,3   0.774469
00010        tiger192,3   0.776314
00011        tiger128,3   0.777004
00012        ripemd128    0.896674
00013        sha256       1.011164
00014        md5          1.016032
00015        tiger160,4   1.056617
00016        tiger128,4   1.063101
00017        tiger192,4   1.069258
00018        haval160,3   1.125099
00019        haval128,3   1.125679
00020        haval224,3   1.128017
00021        haval192,3   1.130026
00022        haval256,3   1.134846
00023        ripemd160    1.150693
00024        haval128,4   1.686261
00025        haval192,4   1.687274
00026        haval160,4   1.693091
00027        haval256,4   1.699323
00028        haval224,4   1.743094
00029        haval160,5   2.003452
00030        haval192,5   2.008341
00031        haval256,5   2.009048
00032        haval128,5   2.009555
00033        haval224,5   2.015539
00034        sha384       3.370734
00035        sha512       3.381121
00036        whirlpool    6.912327
00037        snefru       9.268168
00038 
00039  Measures on a Desktop P4-2.4 512MB Debian (Linux-2.4):
00040        md5          0.147739
00041        haval128,3   0.317006
00042        haval192,3   0.317524
00043        haval256,3   0.317526
00044        haval160,3   0.323035
00045        haval224,3   0.333318
00046        ripemd128    0.353447
00047        sha1         0.376200
00048        ripemd160    0.413758
00049        sha256       0.435957
00050        haval160,4   0.452357
00051        haval224,4   0.454531
00052        haval128,4   0.458026
00053        haval256,4   0.459051
00054        haval192,4   0.468094
00055        haval128,5   0.524262
00056        haval160,5   0.529573
00057        haval224,5   0.533655
00058        haval256,5   0.534446
00059        haval192,5   0.543726
00060        tiger128,3   0.577975
00061        tiger160,3   0.579951
00062        tiger192,3   0.597111
00063        tiger192,4   0.781408
00064        tiger160,4   0.801243
00065        tiger128,4   0.812239
00066        sha512       1.298627
00067        sha384       1.313607
00068        whirlpool    1.556159
00069        snefru       5.703742
00070 
00071 */
00072 
00073 error_reporting(E_ALL&~E_NOTICE);
00074 
00075 $data = file_get_contents(__FILE__);
00076 $time = array();
00077 
00078 for ($j = 0; $j < 10; $j++) {
00079        foreach (hash_algos() as $algo) {
00080               $start = microtime(true);
00081               for ($i = 0; $i < 1000; $i++) {
00082                      hash($algo, $data);
00083               }
00084               $time[$algo] += microtime(true)-$start;
00085        }
00086 }
00087 
00088 asort($time, SORT_NUMERIC);
00089 foreach ($time as $a => $t) {
00090        printf("%-12s %02.6f\n", $a, $t);
00091 }
00092 ?>