Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97595 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81947 invoked from network); 8 Jan 2017 20:38:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jan 2017 20:38:11 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@ohgaki.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@ohgaki.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ohgaki.net designates 180.42.98.130 as permitted sender) X-PHP-List-Original-Sender: yohgaki@ohgaki.net X-Host-Fingerprint: 180.42.98.130 ns1.es-i.jp Received: from [180.42.98.130] ([180.42.98.130:56892] helo=es-i.jp) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 21/2C-31343-133A2785 for ; Sun, 08 Jan 2017 15:38:11 -0500 Received: (qmail 57354 invoked by uid 89); 8 Jan 2017 20:38:06 -0000 Received: from unknown (HELO mail-wm0-f51.google.com) (yohgaki@ohgaki.net@74.125.82.51) by 0 with ESMTPA; 8 Jan 2017 20:38:06 -0000 Received: by mail-wm0-f51.google.com with SMTP id a197so80184456wmd.0 for ; Sun, 08 Jan 2017 12:38:04 -0800 (PST) X-Gm-Message-State: AIkVDXJPySIFyuquFdYPlDWAqPA1GojlL4Niu1kBcpnlnT3N004/gybDerE4/u+auS2Hw5XMNWV7gBILqFgdbQ== X-Received: by 10.223.160.172 with SMTP id m41mr9100519wrm.116.1483907878489; Sun, 08 Jan 2017 12:37:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.195.12.8 with HTTP; Sun, 8 Jan 2017 12:37:17 -0800 (PST) In-Reply-To: References: <7500b0c6a50baf49beac70ae01e8b50d@koti.fimnet.fi> <87o9zhju4d.fsf@lil.giraffy.jp> Date: Mon, 9 Jan 2017 05:37:17 +0900 X-Gmail-Original-Message-ID: Message-ID: To: Kazuo Oishi Cc: =?UTF-8?Q?Lauri_Kentt=C3=A4?= , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a114e3092fa225605459b3925 Subject: Re: [PHP-DEV] Use decent entropy for uniqid($prefix, TRUE) From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a114e3092fa225605459b3925 Content-Type: text/plain; charset=UTF-8 On Mon, Jan 9, 2017 at 5:31 AM, Yasuo Ohgaki wrote: > On Mon, Jan 9, 2017 at 3:15 AM, Kazuo Oishi wrote: > >> No. Lauri's version is better. >> >> Your php_random_bytes_throw() version is significantly slow. Lauri's >> version is faster and cleaner. >> >> [original uniqid() using php_combined_lcg] >> $ time ./php_uniqid_orig -r 'for($i=0; $i<1000000;$i++) uniqid("",true);' >> real 0m0.366s >> user 0m0.350s >> sys 0m0.010s >> >> [your php_random_bytes_throw version (commit >> 48f1a17886d874dc90867c669481804de90509e8)] >> $ time ./php_uniqid_yohgaki -r 'for($i=0; $i<1000000;$i++) >> uniqid("",true);' >> real 0m4.509s >> user 0m0.430s >> sys 0m4.070s >> >> [Lauri's php_random_int version] >> $ time ./php_uniqid_lauri -r 'for($i=0; $i<1000000;$i++) uniqid("",true);' >> real 0m0.664s >> user 0m0.260s >> sys 0m0.400s >> > > Interesting result. AFAIK, I didn't get significant difference when I made > the patch. > What is your system? It seems your PRNG is significantly slow. > The performance will be improved by reducing multiple PRNG calls to 1. I'll modify patch later, could you test it with your system? Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a114e3092fa225605459b3925--