[php-src] PR #13350: random: Remove `php_random_status`
| From: | TimWolla | Date: | Wed, 07 Feb 2024 18:31:03 +0000 |
| Subject: | [php-src] PR #13350: random: Remove `php_random_status` | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-25019@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/13350
Author: TimWolla
Since 162e1dce9870168cb8c65c013f2b5a510b6536b1, the
php_random_status struct contains
just a single void*, resulting in needless indirection when accessing the engine state
and thus decreasing readability because of the additional non-meaningful ->state
references / the local helper variables.
There is also a small, but measurable performance benefit:
<?php
$e = new Random\Engine\Xoshiro256StarStar(0);
$r = new Random\Randomizer($e);
for ($i = 0; $i < 15; $i++)
var_dump(strlen($r->getBytes(100000000)));
goes from roughly 3.85s down to 3.60s.
The names of the status variables have not yet been touched to keep the diff small.
They will be renamed to the more appropriate state in a follow-up cleanup commit.