Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26812 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19301 invoked by uid 1010); 6 Dec 2006 12:58:32 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 19286 invoked from network); 6 Dec 2006 12:58:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Dec 2006 12:58:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 212.25.124.162 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 212.25.124.162 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from [212.25.124.162] ([212.25.124.162:13236] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 44/8B-54198-03EB6754 for ; Wed, 06 Dec 2006 07:57:56 -0500 Received: (qmail 14175 invoked from network); 6 Dec 2006 12:55:50 -0000 Received: from internal.zend.office (HELO thinkpad) (10.1.1.1) by internal.zend.office with SMTP; 6 Dec 2006 12:55:50 -0000 To: "'Sara Golemon'" , Cc: "Andi Gutmans" Date: Wed, 6 Dec 2006 15:57:02 +0300 Message-ID: <000001c71936$076ef8b0$6e02a8c0@thinkpad> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 Importance: Normal In-Reply-To: <4573B6BC.1030602@php.net> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962 Subject: RE: [PHP-DEV] Function call speedup (CV applied to functions) From: dmitry@zend.com ("Dmitry Stogov") References: <4573B6BC.1030602@php.net> Hi Sara, Interesting patch. We had very similar idea in the past. BTW it is possible to optimize function calls mach more. Not only ZEND_DO_FCALL but also ZEND_INIT_FCALL_BY_NAME can be optimized, and we can reuse the same cache entries for all op_arrays from the same PHP file. I'll make a patch and send it to you in fey days. Thanks. Dmitry. > -----Original Message----- > From: Sara Golemon [mailto:pollita@php.net] > Sent: Monday, December 04, 2006 8:49 AM > To: internals@lists.php.net > Subject: [PHP-DEV] Function call speedup (CV applied to functions) > > > It's been a concept stuck in my mind since I first looked > into ZE2.1 and > saw what compiled variables were, and a recent blog post > (http://php100.wordpress.com/2006/11/24/optimizations/) (which got > picked up by planet PHP) got my wheels spinning again. Tonight I > decided to actually sit down and see what benefit could be > milked from > such an endeavor and what it's maintenance cost would be. > > The attached patch shows what I've tossed together for HEAD and the > benchmark I've run against it do show some appreciable gains... > > Based on this code snippet, I saw a consistent gain of > aproximately 18%: for($i = 0; $i < 10000000; $i++) pi(); > > I chose the pi() function as it (A) would actually favor the > unpatched > approach, being quick to hash and strcmp. It also (B) > performs minimal > actual work, simply returning a constant value, thus leaving > as much of > the execution time to the matter being tested as possible. > > Of course, this isn't a "normal use" example, and it doesn't address > dynamic function calls or method calls. I also havn't looked > into class > resolution yet, but this is a good spot to begin discussion from. > > Thoughts anyone? > > -Sara >