RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo
| From: | Andrea Giammarchi | Date: | Tue, 06 Oct 2009 23:06:46 +0000 |
| Subject: | RE: [PHP] Whacky increment/assignment logic with $foo++ vs ++$foo | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-298695@lists.php.net to get a copy of this message | ||
> Furthermore, the amount
> of time micro-optimization takes up (going through old code, I mean)
> could be better spent doing something that actually does increase your
> performance, like implementing a search engine or memcached. Going
> forward, if you're aware that ++i and i++ are the same for your
> application and ++i is a single php opcode faster (which I don't know
> if it's even measurable, that difference), sure go ahead and use ++i
> but it's certainly not worth serious thought or developer time.
>
> My two cents.
I do micro optimization with every language I use, when I know, and where I can. I am the one that
usually solves slow query problems, and I use best practices on database as well.
Guys, I don't get your point ... if you know that "$var" is a non-sense, feel free to
use it ... what I know, is that every double quoted string require parsing, due to variable or char
evaluations (\x00) evaluation, if I don't need this waste of time, why should I write a totally
meaningless, useless, "$var" where $var is sufficient or more over
'whatever'.$var will be faster?
The fact is that this is my approach for every layer of an application, I am not like that only with
PHP. There is something to optimize? Make it your code style and you won't spend a sinlge
second more than any other, but at least you'll do your best to reach best performances.
As I have said, I have never had performances problem, and I am a full web stack developer, but you
can obviously do whatever you want, is still a matter of points of view.
Regards
_________________________________________________________________
Windows Live: Keep your friends up to date with what you do online.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010