Stephen,
> If the updated function is always faster when the overall string is at
> least, say, 16 characters long,
But that's not the case - the cost of the function (and the speedup from
the previous version) depends on the number of spaces that there are at
the end.
For the new function to be faster, we need to know that there are more
than 6 (on average, depending on alignment) trailing spaces. The number
of non-space characters in the string won't affect performance (other
than that there is probably a correlation between total string length
and number of spaces, but we can't be certain of that).
> If the new function is always slower, regardless of overall string
> length, when there's only 1 extra space at the end
Yes, that is correct.
Cheers,
Jeremy