Re: Bug #14248: uniqid() is extremely slow (20ms per call)

From: Date: Tue, 27 Nov 2001 09:49:37 +0000
Subject: Re: Bug #14248: uniqid() is extremely slow (20ms per call)
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-71753@lists.php.net to get a copy of this message
Hi bartvb! On Tue, 27 Nov 2001, bartvb@iae.nl wrote: > From: bartvb@iae.nl > Operating system: Linux 2.4.13-ac5 > PHP version: 4.0.5 > PHP Bug Type: Unknown/Other Function > Bug description: uniqid() is extremely slow (20ms per call) > > 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. > I guess it gets entropy from /dev/[u]random, but when it is exhausted it cannot do much but to wait for more entropy. Do you have /dev/urandom on that machine? I think urandom stands for unblocking random (it returns w/o blocking if no entropy is available.) There are also userspace programs that can gather entropy. -- teodor

« previous php.dev (#71753) next »