hash: Use hrtime() in the bench script [ci skip]

Signed-off-by: Anatol Belski <ab@php.net>
This commit is contained in:
Anatol Belski 2021-01-09 21:41:18 +01:00
parent 23590f7c53
commit 2cee1be6d1

View File

@ -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);
}