small optimization for BatString.edit_distance