[php-src] PR #14076: Refactor BCMath 1

From: Date: Mon, 29 Apr 2024 15:14:40 +0000
Subject: [php-src] PR #14076: Refactor BCMath 1
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-25926@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/14076 Author: SakiTakamachi Very rough speed comparison code: ``` <?php $num1 = '1.2345678901234567890'; $num2 = '-2.12345678901234567890'; $start = microtime(true); for ($i = 0; $i < 1000000; $i++) { bcadd($num1, $num2, 20); } echo microtime(true) - $start . PHP_EOL; $num1 = '12345678901234567890.12345678901234567890'; $num2 = '-212345678901234567890.12345678901234567890'; $start = microtime(true); for ($i = 0; $i < 1000000; $i++) { bcadd($num1, $num2, 20); } echo microtime(true) - $start . PHP_EOL; $num1 = '12345678901234567890.00000000000000000000000000000000000000000000000000'; $num2 = '-212345678901234567890.00000000000000000000000000000000000000000000000000'; $start = microtime(true); for ($i = 0; $i < 1000000; $i++) { bcadd($num1, $num2, 20); } echo microtime(true) - $start . PHP_EOL; ``` Executed 4 times each before: ``` // 1 1.0902369022369 1.3490400314331 1.4081330299377 // 2 1.0888631343842 1.3694519996643 1.3896071910858 // 3 1.0688889026642 1.3189589977264 1.3548929691315 // 4 1.0787630081177 1.3229789733887 1.3750591278076 ``` after: ``` // 1 1.0536150932312 1.2873499393463 1.3096930980682 // 2 1.0363819599152 1.2539649009705 1.2816500663757 // 3 1.0219600200653 1.2267670631409 1.2674150466919 // 4 1.0389258861542 1.2177820205688 1.2895710468292 ```

« previous php.git-pulls (#25926) next »