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

The sanity checks would be more interesting if they were correct. You are assuming $_ is set and modified in place, which holds true only for a subset of the solutions.

Try changing the order in which you run the benchmarks, and you'd see that $_ will be the same after my solutions run as before, no matter who else's ran immediately beforehand. Perhaps you should check actual return values of subs which return values.

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

Replies are listed 'Best First'.
Re^3: More efficient way to truncate long strings of the same character
by GrandFather (Saint) on Oct 31, 2008 at 22:15 UTC

    Aye, there's the trouble with starting with a quick and dirty design then accreting bits on to it. :(

    The validation step is important as a check that the tested code is behaving as advertised, but can introduce extra benchmarked code that is unrelated to the code being tested. If I get time I'll revisit the code and fix it, but it may take a while before I get to it.


    Perl reduces RSI - it saves typing