From: "Mehr, Assaph (Assaph)" Date: 2004-08-04T09:40:06+09:00 Subject: Re: Fastest way to reverse-process a string? >> Have you tried benchmark? > I can only benchmark algorithms when I have more than one algorithm to compare. > I only thought of the one algorithm that I mentioned in my original post, and so > I had nothing to benchmark it against. > I can easily do the benchmarking, and I was not asking anyone to do it for me. > I wrote my email because I was looking for algorithm suggestions, such as the third > one that you mentioned. I was previously unaware of 'each_byte'. I also didn't > think of trying the split('') version. Sorry, didn't mean to imply anything. I just had wanted to show the performance of the obvious ways I knew (as I couldn't think of anything smarter). > Thank you for these suggestions. BTW, I also tried Simon's Iterator::Reverse (about 13 seconds) and an explicit idx-- type loop (about 3 seconds). I just wanted to show that the reverse.each_byte (as explained by Joel) creates less objects and seems fastest. Sorry for not making myself clear :(