That's an interesting find, Rob, thanks. But watch out. We're looking at the
ECMAScript standard, not running code. An actual implementation could have
different performance for the two operators and still conform to the spec.
 
It does seem unlikely that anyone would code == to be slower than === , but
as Knuth said, "I have only proven it correct, not tested it." :-)
 
-Mike



  _____  

From: Rob Desbois

There's no overhead unless the types are different. From the ECMAScript
specification:

For the 'abstract equality comparison algorithm' (==) [11.9.3]
1. if Type(x) is different from Type(y), go to step 14. 

For the 'strict equality comparison algorithm' (===) [11.9.3]
1. if Type(x) is different from Type(y), return false.

Steps 2-13 of both algorithms are exactly the same, so if the types match
then there's no difference in the execution of each algorithm, and no
overhead for the abstract algorithm. 

--rob


On 8/2/07, Terry B <[EMAIL PROTECTED]> wrote: 


known about this for awhile but since we are on the topic...  there
has to be some over head of using == and !=....  does anyone know for
sure the impact of the overhead...  and does it matter of the type....

Reply via email to