Fair enough. The only things I would disagree with is that 1) Just because there are only 2500 in the source code doesn't mean that they don't get looped over quite a bit, and 2) my Mac Pro Quad Xeon with 4GB of memory behaves all that much different than the Quad Xeon 4GB webservers that we and our clients have deployed :) The original question came out of the coder module which recommended these changes for better "performance", and I looked into it, and several other projects recommend using lower case for these constants, as well as a couple bugs on the php.net bug list. I actually prefer writing with upper case, so the only point was if there was any real world gain. Here are the links I had found: http://bugs.php.net/bug.php?id=27286&edit=1 http://framework.zend.com/wiki/display/ZFDEV/PHP+Coding+Standard+(draft)?sho... http://drupal.org/node/121388 http://ilia.ws/archives/12-PHP-Optimization-Tricks.html Other PHP software that use lower case true, false and null standard: PEAR Standard - http://pear.php.net/manual/en/standards.naming.php Joomla - http://help.joomla.org/content/view/826/125/ Mambo - http://www.source.mambo-foundation.org/content/view/117/69/ EZ Publish - http://ez.no/ezpublish/documentation/development/standards/php Flyspray - http://flyspray.org/internal:conventions#constant_names OSCommerce - http://svn.oscommerce.com/fisheye/browse/osCommerce/tags/oscommerce-2.2rc1/S... phpMyAdmin - http://phpmyadmin.sourceforge.net/documentation/ Zen Cart - http://www.zen-cart.com/wiki/index.php/Developers_Standards#Naming_Conventio... phpBB - http://area51.phpbb.com/docs/coding-guidelines.html#optimizing And finally, thank you Peter for updating the docs to clarify. Sorry to be a performance nut, but I can't help it. I think a lot of us are a little OCD sometimes :D Steve Rude Konstantin Käfer wrote:
1326ms vs. 1382ms is 60ms, and when normal page load times are somewhere around 200ms, it makes a substantial difference.
Even if we disregard the fact that microtime tests have a big stddev, your test is not very convincing: You are using these constants several hundred thousand times whereas Drupal only has 2500+ in its *entire* source code. And of that source code, only a fraction gets to execution. I'd estimate the number of constants that are actually executed on a Drupal page view to about 500, and even that is probably too high. If you extrapolate your results (60ms for 100000), you'll get 0.3 msecs. Besides, a real world server behaves quite different from a desktop machine, especially in such edge cases.
Konstantin
-- Steve Rude + Lead Developer *AchieveInternet* (800) 618-8777 x 202 http://www.achieveinternet.com