note 73699 added to language.operators.comparison
| From: | floppie at quadra-tec dot net | Date: | Wed, 07 Mar 2007 06:34:45 +0000 |
| Subject: | note 73699 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124184@lists.php.net to get a copy of this message | ||
I also ran a benchmark of equals versus identical on my own server. I found the difference to be
surprisingly significant (average of 15% across multiple executions of the script). Just for kicks
I had it compare int to float speed as well and that came up to roughly 40% faster in favor of int
(in equal/identical comparisons - no idea how they perform otherwise), and had it compare ==/=== to
!=/!== and came up to negligible difference (averages out to 0). Here are the results over 100k
iterations - if you want to know exactly what comparisons were done let me know:
100000 iterations
total identical 36.142370939255
total equals 41.991316795349
total is 38.998074293137
total not 39.135613441467
total int 29.253834247589
total float 48.879853487015
%gain identical vs equals 13.928941272788
%gain is vs not 0.35144242350103
%gain int vs float 40.151550872875
total time 78.15989112854
----
Server IP: 69.147.83.197
Probable Submitter: 71.162.154.10
----
Manual Page -- http://www.php.net/manual/en/language.operators.comparison.php
Edit -- https://master.php.net/note/edit/73699
Del: integrated -- https://master.php.net/note/delete/73699/integrated
Del: useless -- https://master.php.net/note/delete/73699/useless
Del: bad code -- https://master.php.net/note/delete/73699/bad+code
Del: spam -- https://master.php.net/note/delete/73699/spam
Del: non-english -- https://master.php.net/note/delete/73699/non-english
Del: in docs -- https://master.php.net/note/delete/73699/in+docs
Del: other reasons-- https://master.php.net/note/delete/73699
Reject -- https://master.php.net/note/reject/73699
Search -- https://master.php.net/manage/user-notes.php