You are here: Re: Performance impact about unquoted strings « PHP Programming Language « IT news, forums, messages
Re: Performance impact about unquoted strings

Posted by Jerry Stuckle on 09/13/06 03:33

Hermann.Richter@gmail.com wrote:
> I asked this question on php.general, but I didn't get any reply. So
> I'm asking here now.
>
> As you already know, when an identifier is not found to be a defined
> constant, php interprets it as a string.
>
> For example:
> <?
> $var=hello ;
> ?>
>
> the "constant" hello is not defined, so $var takes the value "hello".
>
> My question is the following:
>
> I have a large script with several thousands of strings.
> In order to reduce the files size, I removed all the quotes from the
> strings.
>
> What is the performance impact of this in terms of cpu-time and system
> resources required??
>
> I mean, the script will take longer to execute??
> will it take more cpu??
>
> Thanks in advance.
>

Yes, it will take longer to execute and require more CPU. Rather than
just accept the value as a string, the parser has to search through
defined values to see if each string is defined or not. Additionally,
PHP generates a notification for each one. The notification itself can
be turned off, but the error handler still needs to run to find out the
notification is not to be sent.

Additionally, there is no guarantee it will work in future versions of PHP.

Put them back in. Not having them is just sloppy programming. And a
few hundred bytes are not going to make much difference.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация