From: Mat Schaffer Date: 2006-07-28T02:28:27+09:00 Subject: Re: String#chop slow? REALLY slow? On Jul 27, 2006, at 1:18 PM, Caleb Clausen wrote: > On 7/27/06, Mat Schaffer wrote: >> I just did a quick benchmark to prove something to myself. But I'd >> like to get a sanity check from the people on the list. > [snip] >> Benchmark.bmbm do |bench| >> bench.report("Indexing") { >> n.times do >> bigstring[0..-1] >> end >> } > [snip] > > No-one seems to have noticed the typo....? I think that 4th line > should be: > > bigstring[0..-2] > > Which is slower. That should account for part of the performance gap. > You're totally right! [0..-1] is the same string. Thanks for the catch. I'm surprised it took that long. Thanks for all the advice, everyone. Sorry to be a little brain-dead. -Mat