ID:               14248
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Closed
 Bug Type:         Unknown/Other Function
 Operating System: Linux 2.4.13-ac5
 PHP Version:      4.0.5
 New Comment:

Here is what I noticed :

A call to uniqid("") takes between 12 and 20 ms.
A call to uniqid("",1) is extremely fast (below 1 ms).

In the code the only difference is, with no entropy, "usleep(1)".
That's not explain the difference I found.

Why is it so long without entropy?


Previous Comments:
------------------------------------------------------------------------

[2002-02-20 11:21:24] [EMAIL PROTECTED]

This is still an issue with RH 7.1, PHP 4.0.6.
Performs fine under Windows 2000.

I would like to suggest that the performance issue be mentioned on
uniqid() documentation. I probably spent a week looking at this issue.


Our sites used the uniqid() function very heavily. This was a tough one
to find! 

Just a thought to save someone else's sanity.

Mike Boulet
Newfangled Web Factory
www.newfangled.com

------------------------------------------------------------------------

[2001-11-27 04:53:08] [EMAIL PROTECTED]

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

------------------------------------------------------------------------

[2001-11-27 04:47:14] [EMAIL PROTECTED]

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

Reply via email to