Bug #14248 Updated: uniqid() is extremely slow (20ms per call)
| From: | derick@php.net | Date: | Tue, 27 Nov 2001 09:53:08 +0000 |
| Subject: | Bug #14248 Updated: uniqid() is extremely slow (20ms per call) | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-71754@lists.php.net to get a copy of this message | ||
ID: 14248
Updated by: derick
Reported By: bartvb@iae.nl
Old Status: Open
Status: Closed
Bug Type: Unknown/Other Function
Operating System: Linux 2.4.13-ac5
PHP Version: 4.0.5
New Comment:
The implementation of uniqid is as fast as it could be, so speeding it up is not really possible
(without loosing randomness)
You can however try this:
$uniq = md5 (time());
This will not be that unique as uniqid, but it should be good enough.
Derick
Previous Comments:
------------------------------------------------------------------------
[2001-11-27 04:47:14] bartvb@iae.nl
A call to uniqid() seems to take approximately 20ms. In all that time the processor seems to be
doing absolutely nothing (well, it seems to be waiting for something).
I wrote a convert script which uses uniqid() while testing it it took 40 seconds to convert 1600
items, without uniqid() the time went down to 3 seconds.. Quite a remarkable performance boost ;)
Especially since the script was made to convert around 300.000 items.
Please speed up this function..
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=14248&edit=1