Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58959 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 88257 invoked from network); 15 Mar 2012 14:57:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Mar 2012 14:57:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@googlemail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 209.85.217.170 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@googlemail.com X-Host-Fingerprint: 209.85.217.170 mail-lb0-f170.google.com Received: from [209.85.217.170] ([209.85.217.170:57489] helo=mail-lb0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B6/21-15833-863026F4 for ; Thu, 15 Mar 2012 09:57:45 -0500 Received: by lbbgg13 with SMTP id gg13so1590356lbb.29 for ; Thu, 15 Mar 2012 07:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=UX2Woyu8pshY6PlvGEIhI2Emc4srwFFk4cDyYHXbTZg=; b=De0y9WvUiADrxh9wpnqfR1JP3hXlZ2aCEZ/C3nF16PMtFS0fogB6fpj5WI2YE4nnCn 3el4BLbbGLubq8etj3Q+5h3ab8BZI9+TpjY+EUObmbfzYQbHgUjiuRbKoOHeeHhjhA7c k8Lx17qu1m7e/heAAdjlSDA4TtpzAB3TpXTmEYLgoRg+Tu008nmuXuOePtNDDTbje7Mr K5EDO/GAs/4t4mBncUSrdDEnkuS8L8ImT14t0LJCPQSUwr23O2jF0s3D+cdfxAtRI7GR LQCRFEsL8ueAThaJRCPPCDYxMBSquSOa3ttRZb4Pwn370HQY6DneCTnTZQgNgRkNrfZw bM7g== MIME-Version: 1.0 Received: by 10.112.23.100 with SMTP id l4mr2628148lbf.24.1331823461323; Thu, 15 Mar 2012 07:57:41 -0700 (PDT) Received: by 10.152.127.68 with HTTP; Thu, 15 Mar 2012 07:57:41 -0700 (PDT) In-Reply-To: References: Date: Thu, 15 Mar 2012 15:57:41 +0100 Message-ID: To: Klaus Silveira Cc: PHP Internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Small question about performance From: nikita.ppv@googlemail.com (Nikita Popov) On Thu, Mar 15, 2012 at 3:21 PM, Klaus Silveira wro= te: > Hello internals, > > I've been involved in a discussion at the PHP Standards Group and we > recently had the following statement: > > *Say you had a loop, and inside that loop you wanted to modify a param >> **update the key:** >> **foreach($a as $key =3D> $val) { >> ** =A0 $a[$key] =3D someLong(functionCalls(hereThat($spanOver85Chars))); >> **}** >> **If this exceeded the line width, you would have to split things like >> **this over a few lines, storing the val temporarily in a zval's until >> **you reached your end computation. Therefore allocating more memory >> **iteratively. * If I am understanding the text correctly it is saying that $f1 =3D f1(); $f2 =3D f2($f1); $f3 =3D f3($f2); is using more memory than $f3 =3D f3(f2(f1())); For me this doesn't make any sense. In the latter case PHP will also create temporary variables to store the return values. There should be no difference in memory consumption. Nikita