in reply to Re^2: simple string comparison for efficiency
in thread simple string comparison for efficiency

Most interesting...

I realize I had naively (and unquestioningly) assumed that the look-up approach would allow one to effectively combine multiple operations into one, thus saving time. But now I see that
    p1[ i ] != p2[ i ] && p1[ i ] != 'N' && p2[ i ] != 'N'
will (assuming most characters are equal) boil down to something close to two indexed accesses on average, whereas
    c_map[ str1[i] ^ str2[i] ]
will always involve three accesses. (I assume the costs of the  != and  ^ operations are about the same.)

And that doesn't begin to address the fact that the look-up approach will not scale to register-wide operations!

... and enlightening.