As we discussed in the chatterbox, and you determined experimentally, it's better to remove that assumption and make the inner loop go over all the strings, but keep the bailing out when the previously determined minimum maximum distance (I chortle as I write that) is met or exceeded.
The current iteration of your code still has the "next if" commented out; I don't see a reason for this. | [reply] |
ysth,
Thanks. Removing the comment from next really didn't make a difference by itself. Having all the optimizations in tandem is a signficant improvement. Hopefully someone will find something completely different that is also very fast.
| [reply] |