Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37134 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64536 invoked from network); 18 Apr 2008 14:26:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Apr 2008 14:26:29 -0000 Authentication-Results: pb1.pair.com header.from=php_lists@realplain.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php_lists@realplain.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain realplain.com from 209.151.69.1 cause and error) X-PHP-List-Original-Sender: php_lists@realplain.com X-Host-Fingerprint: 209.151.69.1 liberty.vosn.net Linux 2.4/2.6 Received: from [209.151.69.1] ([209.151.69.1:41425] helo=liberty.vosn.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B9/51-54733-49FA8084 for ; Fri, 18 Apr 2008 10:26:29 -0400 Received: from 75-121-98-223.dyn.centurytel.net ([75.121.98.223]:65334 helo=pc1) by liberty.vosn.net with smtp (Exim 4.68) (envelope-from ) id 1JmrXl-0007Xe-ES for internals@lists.php.net; Fri, 18 Apr 2008 08:26:25 -0600 Message-ID: <00ea01c8a160$2edd8160$0201a8c0@pc1> To: Date: Fri, 18 Apr 2008 09:26:22 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1914 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1914 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - liberty.vosn.net X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - realplain.com Subject: [PATCH] No runtime fetching of built-in global constants From: php_lists@realplain.com ("Matt Wilmas") Hi all, I changed things so that the many "built-in" constants (CONST_PERSISTENT ones) will be replaced at compile-time, saving the FETCH_CONSTANT opcode, if these changes are usable. This was added for TRUE/FALSE/NULL 2 years ago, but seems like it can be done for "lots" of others too. Since the change 2 years ago, other constants have been getting looked up also, but just discarded. And if a constant wasn't found, its name was lowercased and looked up again (for case-insensitive TRUE/FALSE/NULL). Lowercasing has been removed, since case-insensitive constants can't be done (guess an exception was made for TRUE/FALSE/NULL :-)), and TRUE/FALSE/NULL get flagged in the scanner (not reserved words, which Marcus did briefly a few years ago), skipping a hash lookup. BTW, to get this compile-time optimization in a namespace, it needs to be prefixed (::CONSTANT). I also removed an unnecessary memcmp() in zend_get_constant() -- old code that was needed a long time ago, it appears. http://realplain.com/php/const_ct_optimization.diff http://realplain.com/php/const_ct_optimization_5_3.diff Thoughts? Thanks, Matt