speed up cmp(SubString,SubString)

About 1.5x faster. Helps with #8826.