Skip to content

Commit 830c896

Browse files
committed
fix variant
1 parent 37d4649 commit 830c896

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

benchmark/run.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ function () { }
7373
printf(' - %d', count($result['durations']));
7474
})
7575
->map(function($result) { // Calculate the standard deviance
76-
$mean = array_sum($result['durations']) / count($result['durations']);
76+
$count = count($result['durations']);
77+
$mean = array_sum($result['durations']) / $count;
7778

7879
$variance = array_sum(array_map(function($duration) use ($mean) {
7980
return pow($mean - $duration, 2);
@@ -82,7 +83,7 @@ function () { }
8283
return [
8384
'file' => $result['file'],
8485
'mean' => $mean,
85-
'standard_variance' => pow($variance, 0.5),
86+
'standard_variance' => pow($variance / $count, 0.5),
8687
];
8788
})
8889
->subscribe(new CallbackObserver(

0 commit comments

Comments
 (0)