mirror of
https://github.com/php/php-src.git
synced 2024-11-28 12:26:37 +08:00
hash: Use hrtime() in the bench script [ci skip]
Signed-off-by: Anatol Belski <ab@php.net>
This commit is contained in:
parent
23590f7c53
commit
2cee1be6d1
@ -11,15 +11,15 @@ foreach (hash_algos() as $algo) {
|
||||
|
||||
for ($j = 0; $j < 10; $j++) {
|
||||
foreach (hash_algos() as $algo) {
|
||||
$start = microtime(true);
|
||||
$start = hrtime(true);
|
||||
for ($i = 0; $i < 1000; $i++) {
|
||||
hash($algo, $data);
|
||||
}
|
||||
$time[$algo] += microtime(true)-$start;
|
||||
$time[$algo] += hrtime(true)-$start;
|
||||
}
|
||||
}
|
||||
|
||||
asort($time, SORT_NUMERIC);
|
||||
foreach ($time as $a => $t) {
|
||||
printf("%-12s %02.6f\n", $a, $t);
|
||||
printf("%-12s %02.6f\n", $a, $t/1000000000);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user