Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58964 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26872 invoked from network); 15 Mar 2012 16:49:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Mar 2012 16:49:51 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 207.97.245.173 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 207.97.245.173 smtp173.iad.emailsrvr.com Linux 2.6 Received: from [207.97.245.173] ([207.97.245.173:60059] helo=smtp173.iad.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C8/52-16214-EAD126F4 for ; Thu, 15 Mar 2012 11:49:51 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp47.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id 604343A8FAA; Thu, 15 Mar 2012 12:49:48 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp47.relay.iad1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id CACE43A8EAB; Thu, 15 Mar 2012 12:49:47 -0400 (EDT) Message-ID: <4F621DA9.2040609@sugarcrm.com> Date: Thu, 15 Mar 2012 09:49:45 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.1) Gecko/20120208 Thunderbird/10.0.1 MIME-Version: 1.0 To: Nikita Popov CC: Klaus Silveira , PHP Internals References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Small question about performance From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > If I am understanding the text correctly it is saying that > $f1 = f1(); > $f2 = f2($f1); > $f3 = f3($f2); > is using more memory than > $f3 = f3(f2(f1())); Short answer: it doesn't matter, use either as you wish. Long answer: Technically, the former also uses hash buckets to bind values to the symbol table, so it can use more memory (and if it so happens that using these variables makes symbol table go over hashtable threshold, hashtable internal storage size will be increased), so it will consume marginally more memory. But the difference is completely negligible. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227