In the particular code you're citing, it's safe because the types of both operands are invariant, and both are strings. There's no performance savings possible because there'll never need to be any type coercion. Think of ==
as being something like this:
function ==(a, b) { // obviously this is fake
if (a === b) return true;
// type coercion ...
}
Also, personally I think that one should use ===
over ==
because of the semantic differences and not because of performance. Micro-optimizations like that aren't important for the vast majority of code most people write. (It's a little ironic in fact that the check for the presence of jQuery is being done with a oops that was wrong :)typeof
comparison; that itself is a questionably-valuable micro-optimization.)