I have a millions of pairs of string of same length which I want to compare and find the position where it has mismatches.
For example for each $str1 a
$str1
I was going to say, "write it in C" too.
Once there you can use optimization like comparing 4 characters at once (as 32-bit integers).
Or change your representation (4-letter, right?) to use 2-bit to represent a base (?), so that you can compare 16 characters at once.