#23721 [Opn]: TRUE and FALSE constants slower than keywords in previous versions

From: Date: Wed, 21 May 2003 15:05:56 +0000
Subject: #23721 [Opn]: TRUE and FALSE constants slower than keywords in previous versions
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969353715@lists.php.net to get a copy of this message
ID: 23721 Updated by: sniper@php.net Reported By: max at fuck dot org Status: Open Bug Type: Documentation problem Operating System: FreeBSD PHP Version: 4.3.1 New Comment: Code readability always outweights minor performance gains, IMO. :) Previous Comments: ------------------------------------------------------------------------ [2003-05-21 08:57:42] max at fuck dot org I don't think I would ever use true/false a million times. This came up when talking to someone about which way was 'proper', whereas before it didn't seem to make a difference and now to allow people who want to write 'True' to get their way, it has been changed. While I don't think this is a big performance problem or anything, I think in conjuction with other little slow-downs on a high load site it could have an effect on the speed. It's obviously faster than older versions regardless of how you use it, but I don't think I have ever seen it used in lowercase anywhere on the php website. ------------------------------------------------------------------------ [2003-05-21 03:11:08] derick@php.net Why do you use 1000000 times TRUE or FALSE in your programs anyway? ------------------------------------------------------------------------ [2003-05-21 02:01:07] philip@php.net Use of proper case is faster than "improper" case for case insensitive constants. This includes true/false, null, and define()'s third parameter. Not sure what others... or even if this really should be documented? :) AFAICT, this behavior does not affect magical case insensitive constants such as __file__. This difference is as of 4.2.3 ------------------------------------------------------------------------ [2003-05-20 20:08:24] sniper@php.net In real life applications you really won't notice any difference. And the lowercase version of any constant defined as case-insensitive will always be looked up faster. (ie. true is looked for first, then if not found, TRUE) ------------------------------------------------------------------------ [2003-05-20 19:12:25] max at fuck dot org no, i think it's great the performance is better, but all of a sudden there is a performance difference between using true and TRUE. if true is (as it would seem) the faster and more efficient way of using the keyword, maybe someone should go through the documentation and make a note of that? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/23721 -- Edit this bug report at http://bugs.php.net/?id=23721&edit=1

« previous php.doc (#969353715) next »