Hi !

        I'm not a developer but a simple PHP user and I've found that the PHP
function uniqid() is very slow when using only 1 parameter (i.e. without
the additional "combined LCG" entropy). It takes about 20ms, and with
the LCG option, which should slow down the function, only 35us.
        I've looked at the code in ext/standard/uniqid.c and there is a call to
the C function usleep(1). This call usually takes about 20ms because of
the resolution of the linux kernel timer (see man nanosleep). Why
exactly is usleep(1) called ? Do you plan to remove it ? 20ms is may be
a lot on a web page.
                                Thanks a lot

the code :
---------------------------------------
#if HAVE_USLEEP && !defined(PHP_WIN32)
        if (!MORE_ENTROPY) {
                usleep(1);
        }
#endif
---------------------------------------

-- 
Sylvain Fétiveau   Tel. (33)2 51 36 37 26
Webmotion Inc.     http://www.webmotion.com
mailto:[EMAIL PROTECTED]

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to