note 64773 added to language.control-structures
| From: | redatiklanumumdotcom at osu1 dot php dot net | Date: | Thu, 20 Apr 2006 13:05:15 +0000 |
| Subject: | note 64773 added to language.control-structures | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-108809@lists.php.net to get a copy of this message | ||
This is very unique!
First structure:
if ($a)
{}
else
{
only do this
}
The above structure does executed 12.77% faster than the second structure below! I had loop it 20
millions time and I got this unique result.
Second structure:
if (!$a)
{
only do this
}
By considering this fact then my programming-script will be written awful if I want to do "only
do this".
For "CODE CLEANLINESS" and logic purpose I shall use the second structure BUT for
"SPEED" purpose I better use the first one.
Although the different is not significant (will be differ about 3 seconds after 20 millions loop)
but I hope PHP developers take time to review how PHP parse (handle) this kind of structure. Well,
I'm not sure this could be happened in C++ or others too. But since I mostly use PHP then this
becomes my concern.
I wonder what people think about my script if they see that I use the former.
I worship the speed above all :)
----
Server IP: 202.67.10.139
Probable Submitter: 61.5.68.57
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.control-structures.php
Edit -- http://master.php.net/note/edit/64773
Del: integrated -- http://master.php.net/note/delete/64773/integrated
Del: useless -- http://master.php.net/note/delete/64773/useless
Del: bad code -- http://master.php.net/note/delete/64773/bad+code
Del: spam -- http://master.php.net/note/delete/64773/spam
Del: non-english -- http://master.php.net/note/delete/64773/non-english
Del: in docs -- http://master.php.net/note/delete/64773/in+docs
Del: other reasons-- http://master.php.net/note/delete/64773
Reject -- http://master.php.net/note/reject/64773
Search -- http://master.php.net/manage/user-notes.php