in reply to Re^2: More efficient way to truncate long strings of the same character
in thread More efficient way to truncate long strings of the same character

It does change the benchmark for me somewhat. Under 5.10.0 on my 1GHz system, your fixed version of GrandFather's substitution actually performed better for the longer string 4 out of 5 runs of the benchmark.

Interestingly enough, under 5.10.0 on this system, the original version posted is always one of the three fastest on the shorter string (and usually the fastest other than GrandFather's version). It's usually about 25% faster than the next. Under 5.8.8 on the same system, it's in a dead heat for the top for the longer string as well. 5.10.0 moves it back quite a bit in the rankings on the longer string, but it's still quite respectable in comparison.

This reeks of premature optimization, but perhaps it isn't.

  • Comment on Re^3: More efficient way to truncate long strings of the same character