[php-src] PR #13579: random: Embed the Mt19937 and CombinedLCG state within the module globals
| From: | TimWolla | Date: | Sat, 02 Mar 2024 20:16:49 +0000 |
| Subject: | [php-src] PR #13579: random: Embed the Mt19937 and CombinedLCG state within the module globals | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-25217@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/13579
Author: TimWolla
Somewhat related to #13577
------------
These are always dynamically allocated in GINIT, thus always take up memory. By embedding them here
we can avoid the dynamic allocation and additional pointer indirection accessing them.
The test script:
<?php
for ($i = 0; $i < 9999999; $i++) mt_rand(1, 100);
Appears to run slightly faster with this change applied: Before this change it always ran in just
over 3 seconds, after this change I was also seeing times below 3 seconds. Howver results are too
close and too jittery to state this performance improvement as a fact.