in reply to fastest way to compare numerical strings?

Is there a reason why your inner loop starts $v at 0?

Your loop seems to start by comparing 0 to 0, then to 1, then to 2...When $n increments you compare 1 to 0, 1 to 1, etc. But aren't all the comparisons for $v <= $n ones that you've already done? There doesn't seem to be an obvious value to comparing 0 to 1, and then later comparing 1 to 0. They are, after all, both members of the same list.

Could you change the inner loop to start with $v = $n + 1 and reduce the number of comparisons significantly?

  • Comment on Re: fastest way to compare numerical strings?