Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67406 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3414 invoked from network); 12 May 2013 19:49:36 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 May 2013 19:49:36 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.49 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.219.49 mail-oa0-f49.google.com Received: from [209.85.219.49] ([209.85.219.49:47609] helo=mail-oa0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9C/35-55400-F42FF815 for ; Sun, 12 May 2013 15:49:35 -0400 Received: by mail-oa0-f49.google.com with SMTP id k14so5270510oag.36 for ; Sun, 12 May 2013 12:49:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=K28hyjx4CcXMUE947ruhdkAwvrpPYU7jHA1kRZdNbnY=; b=fwTFMApflC+VqHWGQ/rL4HVEig7eWnFySuzA0aGadbuzVH4PYs9XCli6OJlw1WgoJY ZWfKzmOhyn8plZqeBlwDaZL7ujVsFZN3QrcPUYX9OTeyh9OKfdlsxHMUhEVVT4xuUWwr rMa64ioREqpnlPWm+M7IICTF+ahGQQAYCKVCfH9QpSta7ZeK9WQ0w1rK6HaEktDiN05d ANHLT8OFC22m+DB4RNTn7pd+R1qKX7GlVgj/W8gr/x6k6dMu1+flTjDyL9lMc28T5spk WxoWchV2x7WN4P2rLv9WngyfCc0LYGf6gVdI5n4RGyCMrMd29FzGvybXc5X1om867oAf zS2w== MIME-Version: 1.0 X-Received: by 10.182.242.42 with SMTP id wn10mr9692867obc.37.1368388172744; Sun, 12 May 2013 12:49:32 -0700 (PDT) Received: by 10.182.49.136 with HTTP; Sun, 12 May 2013 12:49:32 -0700 (PDT) In-Reply-To: References: <518FD653.6070705@daylessday.org> Date: Sun, 12 May 2013 21:49:32 +0200 Message-ID: To: Antony Dovgal Cc: PHP internals Content-Type: multipart/alternative; boundary=e89a8ff251b6f38f7a04dc8ab21f Subject: Re: [PHP-DEV] [RFC] Internal operator overloading and GMP improvements From: nikita.ppv@gmail.com (Nikita Popov) --e89a8ff251b6f38f7a04dc8ab21f Content-Type: text/plain; charset=ISO-8859-1 On Sun, May 12, 2013 at 9:02 PM, Nikita Popov wrote: > I think this is a misunderstanding. I do not suggest to use GMP for all > arithmetic and also do not suggest to auto-promote to GMP for large numbers. > > The operator overloading only comes into play if one of the operands is > already a GMP instance. > > Regarding performance: The addition of the operator overloading does have > a measurable impact on performance. > Ooops, that was a typo. I wanted to say "does NOT have a measurable impact on performance". > The switch of GMP from resources to objects also does not show any clear > change either way. What does become faster is if a gmp function gets a > non-gmp argument and needs to cast it to GMP (this is faster because now > only the mpz_t instance is created and not a full resource). Obviously when > the overloaded operators are used rather than the functions it's faster too. > I tweaked the implementation a bit and now it seems to be faster in any case. I added some numbers in https://wiki.php.net/rfc/operator_overloading_gmp#performance Nikita --e89a8ff251b6f38f7a04dc8ab21f--