Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69251 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71852 invoked from network); 21 Sep 2013 12:54:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Sep 2013 12:54:42 -0000 Authentication-Results: pb1.pair.com header.from=njaguar@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=njaguar@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.52 as permitted sender) X-PHP-List-Original-Sender: njaguar@gmail.com X-Host-Fingerprint: 209.85.215.52 mail-la0-f52.google.com Received: from [209.85.215.52] ([209.85.215.52:55480] helo=mail-la0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 31/20-05375-C079D325 for ; Sat, 21 Sep 2013 08:54:37 -0400 Received: by mail-la0-f52.google.com with SMTP id ev20so1212382lab.11 for ; Sat, 21 Sep 2013 05:54:33 -0700 (PDT) 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; bh=+kszOGQiZllPC65wSjzyJv8oS074WN2h4YxhG1h1bvc=; b=l2LAme1ur6ta0aUsEYeP7UJxm3yfHBAHcef2GNBXIJmmQwrYCZ/ibrQEHfvbDY1VW9 a6RaiAZA2Wv1Jl6Z8SQLa37/t74u4nf7nZ0/tO4DaOXzWEdUxY6EE2Ki+c1Gt7mppiQb P2rJSO+2+EgPysclGVBQEWO1WoOPWQujWB6PPKbQB/+K7TjmxNDxNDelq7lYupkOenV0 wurCBQIiJbrUeAekiZwWZVUeCNmoc41OzW1Ln477p67cNb2BGT6XyEB0v2j9wbWgIS/o DmP2Tlf6qebztFuL0zah0X8Cc6YZrORd6M+nd03uTeYXHXm664ZFTfWGMyVurp7vHiT/ iiXA== MIME-Version: 1.0 X-Received: by 10.152.87.143 with SMTP id ay15mr10814902lab.2.1379768073523; Sat, 21 Sep 2013 05:54:33 -0700 (PDT) Received: by 10.152.45.42 with HTTP; Sat, 21 Sep 2013 05:54:33 -0700 (PDT) In-Reply-To: References: <17.B1.31578.06A3C325@pb1.pair.com> <92.22.31578.33D3C325@pb1.pair.com> Date: Sat, 21 Sep 2013 07:54:33 -0500 Message-ID: To: ruben Cc: internals Content-Type: multipart/alternative; boundary=001a11c2409ce517eb04e6e449a2 Subject: Re: [PHP-DEV] Re: Performance update involving zval containers. Why not possible? From: njaguar@gmail.com (Paul Taulborg) --001a11c2409ce517eb04e6e449a2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Fri, Sep 20, 2013 at 10:01 AM, ruben wrote: > Pascal Chevrel wrote: > >> Le 20/09/2013 14:06, ruben a =E9crit : >> >>> Hi, >>> >>> first of all I want to say that I am just a newbie in PHP. I am >>> switching to PHP from other languages and I am exploring how PHP manage= s >>> references. To do that I am gathering information about what happens >>> with Symbol Tables and Variables Containers when using references. You >>> know: reference-counting, copy-on-write and all that stuff... >>> >>> I found out some cases where I think that some Variable Containers >>> copies could be skipped, thus saving memory and improving performance >>> relying in the copy-on-write principle. I wrote a PDF trying to explain >>> what I mean. It is not written in a very techy language, because I am >>> just new and don't know too much about the internals, but I hope you ca= n >>> understand it and post your comments. >>> >>> Probably if my "update" hasn't been done yet, is because it is not >>> possible, but I will very glad to hear your comments and learn from you= . >>> >>> Thank you very much. >>> >>> >> Hi Ruben, >> >> I think you forgot to put a link to your pdf :) >> >> Regards, >> >> Pascal >> > > Sorry, here it is: > https://www.dropbox.com/s/wxdc99miw82zje9/PHP_references.pdf Change the function to: function & do_something(& $s) { and it should do what you are expecting, reusing a single reference. http://www.php.net/manual/en/language.references.return.php for more reference. --001a11c2409ce517eb04e6e449a2--