minor speed ups for calcEditDistances