* Jeremy Kerr (j...@ozlabs.org) wrote: > > Is it just the size that matters, or is it when there are few spaces > > at the end? > > It's the number of spaces at the end. If we knew this number, then we > wouldn't have to do any comparisons at all :)
I meant in terms of affecting the performance of this function.. We know the total length of the string, including spaces, coming into the function. If the updated function is always faster when the overall string is at least, say, 16 characters long, then Dimitri's suggestion to just check the overall length coming in and decide which approach to use might make sense. If the new function is always slower, regardless of overall string length, when there's only 1 extra space at the end, then chances are it's not worth it. Thanks, Stephen
signature.asc
Description: Digital signature