Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53375 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15111 invoked from network); 20 Jun 2011 10:48:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jun 2011 10:48:55 -0000 Authentication-Results: pb1.pair.com smtp.mail=robert@xarg.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=robert@xarg.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain xarg.org from 209.85.220.170 cause and error) X-PHP-List-Original-Sender: robert@xarg.org X-Host-Fingerprint: 209.85.220.170 mail-vx0-f170.google.com Received: from [209.85.220.170] ([209.85.220.170:56735] helo=mail-vx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5E/F5-34681-6952FFD4 for ; Mon, 20 Jun 2011 06:48:55 -0400 Received: by vxi39 with SMTP id 39so819024vxi.29 for ; Mon, 20 Jun 2011 03:48:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.189.13 with SMTP id dc13mr1733739vcb.169.1308566931302; Mon, 20 Jun 2011 03:48:51 -0700 (PDT) Received: by 10.220.45.196 with HTTP; Mon, 20 Jun 2011 03:48:51 -0700 (PDT) X-Originating-IP: [92.225.216.141] Date: Mon, 20 Jun 2011 12:48:51 +0200 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=90e6ba4fc3ae1ae93f04a6227b53 Subject: Standard constants as part of the lexer From: robert@xarg.org (Robert Eisele) --90e6ba4fc3ae1ae93f04a6227b53 Content-Type: text/plain; charset=ISO-8859-1 The constants true, false and null are used very often. Unfortunately, every usage of either of these constants invokes a constant lookup. There is no problem with this, constant lookups are fast, but I nevertheless implemented these constants directly in the lexer to avoid these lookups. I'd be glad to see this change in 5.4 as the performance enhancement would be a steal. I've also added a new OP code to hard-code count() and strlen() which improves the performance by ~800%. This is nice, but limits the usage of count() and strlen() as method name - if no further changes will be made at the parser. I would rather see a optimization for every function call in 5.4.x. I'll take a look at this soon, maybe I can provide a patch for this, too. What do you think about the constants optimization? Unfortunateley, I've broken the power cable of my macbook and have to wait for a new one. I'll deliver in addition the patch if you like the idea. Robert --90e6ba4fc3ae1ae93f04a6227b53--