Lauri Kenttä <lauri.ken...@gmail.com> writes:
>> signed 32 bit int range. This version is as fast as php_combined_lcg()
>> version on my system. Both versions executes a million uniqid() calls
>> about 0.36 sec.
>>
>> $ php -r '$s = microtime(TRUE);for($i=0;$i<1000000;$i++) uniqid("",
>> TRUE); echo microtime(TRUE) - $s;'
>>
>> 0.36102104187012
>>
>> So above patch would be the final patch. I don't expect issues but if
>> there is performace issue on some systems, we may consider Lauri's
>> integer computation version.
>
> I can confirm that the integer version is faster (2,6 seconds vs 3,6 seconds 
> for
> 1000000 uniqid calls). Testing on ARM (Raspberry Pi) gives similar results. 
> It's
> not surprising, since converting to float/double is not free and formatting a
> floating-point number is also slower than formatting an integer.

I have same result; integer version is 0.65 seconds and double version
is 0.82 seconds.

-- 
Kazuo Oishi

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to