Skip to content

Commit

Permalink
Update benchmark.php
Browse files Browse the repository at this point in the history
Stripped out the pi maths function.
It doesn't really do any maths, just returns a constant float M_PI which doesn't really benchmark PHP mathematical performance.

(See: /ext/standard/php_math.h:#define M_PI           3.14159265358979323846  /* pi */)

Also as of PHP 8.0 it will throw a PHP Fatal error if you pass an argument to the pi function:

PHP Fatal error:  Uncaught ArgumentCountError: pi() expects exactly 0 arguments, 1 given in /var/www/html/benchmark.php:182
  • Loading branch information
solarisfire authored Feb 8, 2021
1 parent 9cfb46b commit 8ab25e8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion benchmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function test_math(&$result, $count = 99999)
{
$timeStart = microtime(true);

$mathFunctions = array("abs", "acos", "asin", "atan", "bindec", "floor", "exp", "sin", "tan", "pi", "is_finite", "is_nan", "sqrt");
$mathFunctions = array("abs", "acos", "asin", "atan", "bindec", "floor", "exp", "sin", "tan", "is_finite", "is_nan", "sqrt");
for ($i = 0; $i < $count; $i++) {
foreach ($mathFunctions as $function) {
call_user_func_array($function, array($i));
Expand Down

0 comments on commit 8ab25e8

Please sign in to comment.