Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97627 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78387 invoked from network); 9 Jan 2017 15:52:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Jan 2017 15:52:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=oishi@giraffy.jp; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=kazuo@o-ishi.jp; sender-id=pass Received-SPF: pass (pb1.pair.com: domain giraffy.jp designates 49.212.134.110 as permitted sender) X-PHP-List-Original-Sender: oishi@giraffy.jp X-Host-Fingerprint: 49.212.134.110 www7096uf.sakura.ne.jp Received: from [49.212.134.110] ([49.212.134.110:47353] helo=xii.giraffy.jp) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 33/8B-31343-8C1B3785 for ; Mon, 09 Jan 2017 10:52:41 -0500 Received: from localhost (localhost [127.0.0.1]) by xii.giraffy.jp (Postfix) with ESMTP id 5015A7C2F0D; Tue, 10 Jan 2017 00:52:37 +0900 (JST) X-Virus-Scanned: amavisd-new at giraffy.jp Received: from xii.giraffy.jp ([127.0.0.1]) by localhost (xii.giraffy.jp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id OTc4v4xP-qq1; Tue, 10 Jan 2017 00:52:35 +0900 (JST) Received: from lil.giraffy.jp (aa024044.ppp.asahi-net.or.jp [110.5.24.44]) by xii.giraffy.jp (Postfix) with ESMTPSA id B66FD7C2EAA; Tue, 10 Jan 2017 00:52:35 +0900 (JST) To: Yasuo Ohgaki Cc: Lauri =?iso-8859-1?Q?Kentt=E4?= , internals@lists.php.net In-Reply-To: ("Lauri \=\?iso-8859-1\?Q\?Kentt\=E4\=22's\?\= message of "Mon, 09 Jan 2017 16:07:50 +0200") References: <7500b0c6a50baf49beac70ae01e8b50d@koti.fimnet.fi> <87o9zhju4d.fsf@lil.giraffy.jp> <87k2a5jcx5.fsf@lil.giraffy.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Date: Tue, 10 Jan 2017 00:52:35 +0900 Message-ID: <87bmvgjkn0.fsf@lil.giraffy.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Use decent entropy for uniqid($prefix, TRUE) From: kazuo@o-ishi.jp (Kazuo Oishi) Lauri Kentt=E4 writes: >> signed 32 bit int range. This version is as fast as php_combined_lcg() >> version on my system. Both versions executes a million uniqid() calls >> about 0.36 sec. >> >> $ php -r '$s =3D microtime(TRUE);for($i=3D0;$i<1000000;$i++) uniqid("", >> TRUE); echo microtime(TRUE) - $s;' >> >> 0.36102104187012 >> >> So above patch would be the final patch. I don't expect issues but if >> there is performace issue on some systems, we may consider Lauri's >> integer computation version. > > I can confirm that the integer version is faster (2,6 seconds vs 3,6 seco= nds for > 1000000 uniqid calls). Testing on ARM (Raspberry Pi) gives similar result= s. It's > not surprising, since converting to float/double is not free and formatti= ng a > floating-point number is also slower than formatting an integer. I have same result; integer version is 0.65 seconds and double version is 0.82 seconds. --=20 Kazuo Oishi