Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53377 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18363 invoked from network); 20 Jun 2011 11:00:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jun 2011 11:00:29 -0000 Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Linux 2.6 Received: from [82.113.146.227] ([82.113.146.227:46528] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/96-34681-C482FFD4 for ; Mon, 20 Jun 2011 07:00:29 -0400 Received: from localhost (xdebug.org [127.0.0.1]) by xdebug.org (Postfix) with ESMTPS id 3776FDE13E; Mon, 20 Jun 2011 12:00:17 +0100 (BST) Date: Mon, 20 Jun 2011 12:00:16 +0100 (BST) X-X-Sender: derick@whisky To: Robert Eisele cc: internals@lists.php.net In-Reply-To: Message-ID: References: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] Standard constants as part of the lexer From: derick@php.net (Derick Rethans) On Mon, 20 Jun 2011, Robert Eisele wrote: > 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. Would that not break the following code?: true(); ?> > 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. Although it's a nice performance increase, I think that breaking count() as a method name is not a good idea, as I would assume it's used a lot. Even though count() and strlen() can be optimised that much, how much does it buy a fully fledged application? Then there is also the deliberation on whether it's good to go this general direction, because I am sure we can make a case to convert every function into an opcode perhaps. cheers, Derick -- http://derickrethans.nl | http://xdebug.org Like Xdebug? Consider a donation: http://xdebug.org/donate.php twitter: @derickr and @xdebug