Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:32444 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21465 invoked by uid 1010); 25 Sep 2007 11:01:57 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 21450 invoked from network); 25 Sep 2007 11:01:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Sep 2007 11:01:57 -0000 Authentication-Results: pb1.pair.com header.from=jared.williams1@ntlworld.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=jared.williams1@ntlworld.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ntlworld.com designates 81.103.221.47 as permitted sender) X-PHP-List-Original-Sender: jared.williams1@ntlworld.com X-Host-Fingerprint: 81.103.221.47 mtaout01-winn.ispmail.ntl.com Solaris 10 (beta) Received: from [81.103.221.47] ([81.103.221.47:54794] helo=mtaout01-winn.ispmail.ntl.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 53/EF-22594-2AAE8F64 for ; Tue, 25 Sep 2007 07:01:55 -0400 Received: from aamtaout04-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com with ESMTP id <20070925110201.XOES1783.mtaout01-winn.ispmail.ntl.com@aamtaout04-winn.ispmail.ntl.com>; Tue, 25 Sep 2007 12:02:01 +0100 Received: from p2 ([82.3.16.111]) by aamtaout04-winn.ispmail.ntl.com with ESMTP id <20070925110139.FPDG29112.aamtaout04-winn.ispmail.ntl.com@p2>; Tue, 25 Sep 2007 12:01:39 +0100 To: "'Nuno Lopes'" , "'PHPdev'" Cc: , , Date: Tue, 25 Sep 2007 12:01:48 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: <001f01c7f6f0$dbcf5350$4001a8c0@pc07653> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4073 Thread-Index: Acf28SRO690/eFUXRn2/krXLLAW2+AIb/igg Message-ID: <20070925110139.FPDG29112.aamtaout04-winn.ispmail.ntl.com@p2> Subject: RE: [PHP-DEV] RFC: mark functions as const for possible optimizations From: jared.williams1@ntlworld.com ("Jared Williams") References: <001f01c7f6f0$dbcf5350$4001a8c0@pc07653> Hi, Just a thought, now dl() has been deprecated and disabled in SAPIs (except CLI,CGI,embed), would that mean extension_loaded() would become a optimizable function? So something like include extension_loaded('gmp') ? 'GMPFoo.php' : 'PHPFoo.php'; Would be optimized to be more APC friendly? Jared > -----Original Message----- > From: Nuno Lopes [mailto:nlopess@php.net] > Sent: 14 September 2007 18:01 > To: PHPdev > Cc: stas@zend.com; andi@php.net; dmitry@php.net > Subject: [PHP-DEV] RFC: mark functions as const for possible > optimizations > > Hi, > > Following my last post on bytecode optimization > (http://news.php.net/php.internals/32113), I would like to > discuss a few more things. > The patch in that e-mail allowed the engine itself to do > transformations like, e.g.: > $a = 1*2*3*4*5+1-0; --> $a = 121; > > However the patch is now a bit dead because Stas would like > to have more advanced things that I didn't have time yet to > look at (because the proposal introduces several difficult > ambiguities in the grammar). > > So, let's move on for now :P > > My proposal is the following: > some functions when fed with constant arguments always return > a constant value, too. e.g.: > strlen('abcd') === 4. > > This means that an optimizer can and should do this > transformation. (and others like: $a='abcd'; strlen($a); -> > 4). I think Ilia created a list of such functions in his > optimizer. But I would like to have that list in the core, so > that everybody can benefit from it. > Basically the only thing needed to do is to change PHP_FE() to > PHP_CONST_FE() in the function entry tables. > > The patch: > http://web.ist.utl.pt/nuno.lopes/zend_const_function_entry.txt > (includes a few function entries changed as an example) > > > Nuno > > P.S.: the university semester has already started, so don't > worry with the > e-mail traffic I'm generating because it'll end pretty soon > (until the next > vacations :P) > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >