Even if you can estimate how many times this
might happen, you'd still be better off actually measuring instead
of guessing (or "estimating" for picky folk).
To me it's a simple arithmetic combined with probability.
V
Yes, you are completely right, there are going to be cases where
this check might pay off, but that totally depends how the objects
are used. In my case I don't see why the situation of a == b and &a
== &b would occur, so it is totally pointless.
I'm a mathematician and no one in my department is a programmer, so
sometimes I do something odd once (with some kind of justification)
and then I get into the habit because there is no one to challenge
me. I've been writing C++ (maybe that should be rewriting!) a lot
for the past year or so, but this is a very subtle and complex
language. Thanks for giving me a little perspective.
back and add this optimization later, when you know it's needed.