Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82732 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64694 invoked from network); 15 Feb 2015 17:51:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Feb 2015 17:51:27 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.180 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.216.180 mail-qc0-f180.google.com Received: from [209.85.216.180] ([209.85.216.180:53292] helo=mail-qc0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 76/A8-06835-C9CD0E45 for ; Sun, 15 Feb 2015 12:51:26 -0500 Received: by mail-qc0-f180.google.com with SMTP id s11so21108156qcv.11 for ; Sun, 15 Feb 2015 09:51:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=1iRQC3KwqqKgzvWhkhgzqQV4g5/X6OuL5Q/fTfMleGI=; b=jBHbLyXhPKdo4/KpIoBsbLiLqfdZQtYoTxShQZSV7SiWxmjET9CF7EWZdUzpchEc/a VrEy5AXPtoMs6dQy+qe5VX9Km3Sgciqhh2gtqB6bq2tM0Gfyla4Im59Q0QYjj4Xk9Usq O5kFSwaeMJ48dZlY/HsHlKpG4XHXnedFKdQsYY9Q/eNtgiWfUMXgyfGTglktsxAHRt6a EK7g5KYeAC8MG1/SoDYPIsa3v1W198vIN+A4gQ7KvqZAebL+QLH1DQNmzbVAGs2geI1k bRcg+e8RFS7b4G/Y5hNHZHRuPzb6uRkg3xColQvHnJSXDDZGQNlH+j6oafrB65ZHmeQL 5jwQ== MIME-Version: 1.0 X-Received: by 10.140.100.184 with SMTP id s53mr21074366qge.96.1424022681704; Sun, 15 Feb 2015 09:51:21 -0800 (PST) Received: by 10.96.39.195 with HTTP; Sun, 15 Feb 2015 09:51:21 -0800 (PST) In-Reply-To: References: <6FD9B9A4-E831-4D4F-AD66-BD04D8C37991@ajf.me> <7472A723-0408-4928-B06D-F0A1CE62EC73@ajf.me> Date: Sun, 15 Feb 2015 18:51:21 +0100 Message-ID: To: Leigh Cc: Andrea Faulds , PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [VOTE] Big Integer Support From: pierre.php@gmail.com (Pierre Joye) On Sun, Feb 15, 2015 at 6:42 PM, Leigh wrote: > On 15 February 2015 at 13:51, Andrea Faulds wrote: >>> Extensions "that deal with numbers" are all going to need updating. So >>> probably every extension? >> >> Anything accepting a zval rather than a long through zpp, but the change= s are quite small in most cases. It=E2=80=99s a much smaller change than, s= ay, what phpng did. > > The real-world performance gains of ng are significant. Everything is > a trade-off. Having to change exts because the guys behind ng have > made (potentially) "80% of all websites" faster is acceptable - in my > opinion. Let be serious here, the zpp changes be for 7 (pls stop calling that ng, it is 7 now :) or for this RFC is irrelevant. An ext wants to support bigint? fine. It can't? Then it will fail or cast with warning or notice. >>> You talk about eventually deprecating ext/gmp and moving it to PECL. >>> Definitely not acceptable. >> >> I *talk* about it. I=E2=80=99m not saying we=E2=80=99ll do it. It=E2=80= =99s a future possibility: since it would be made largely redundant by larg= e integer support in core, we might eventually get rid of it. >> >> I said =E2=80=9Cmight=E2=80=9D because it=E2=80=99s not part of the prop= osal, it is merely a thought. > > The GMP ext offers a lot more than arbitrary precision arithmetic. > There's a slew of functions there that go hand in hand with big ints > and their applications. gmp_inverse, gmp_powm and gmp_rootrem to name > a few. There are applications, both proprietary and open that depend > on these. I'd personally be willing to help bring more functionality > to ext/gmp rather than lose all of these important functions to PECL. Fully agree, gmp allows more. And it should not be removed. While "native" bigint support is really handy and I can see many benefits. Using GMP for other features remain important. >>> Sorry, the fixed size integer data type is far too baked-in and >>> useful. >> >> I could understand your perspective if PHP had modular arithmetic like C= and such, but it doesn=E2=80=99t. So I don=E2=80=99t understand why it is = =E2=80=9Cfar too useful=E2=80=9D - what usefulness is being lost by extendi= ng its range? > > Among other thing the behaviour of overflow and shift operations are > well documented and understood quirks of fixed size integer types. Does that mean it should not be improved? Aka more obvious and less quirky? >>> I don't see any gain from this patch except hidden performance >>> penalties, breaks, and extra work for everyone in maintaining it and >>> other extensions. I'd rather big int usage was kept verbose and >>> conscious. >> >> I see a clear gain: we clean up almost every integer overflow edge case,= integer overflow handling is more intuitive, we support large integers saf= ely on 32-bit, and we don=E2=80=99t require you to use a weird extension th= at may crash the PHP interpreter and DoS your web host in order to do large= number arithmetic. > > A weird extension? The base library of which you are using to back > your big int implementation. I agree here too. gmp is just fine. I see this RFC as a different thing. Having bigint support in the engine makes sense regardless of gmp. Other languages have it and are very happy with that. It is simply way easier and cleaner to use than relying on an ext (while Nikita's patch for operators overloading for exts makes things better). Cheers, --=20 Pierre @pierrejoye | http://www.libgd.org