There's more than one way to do things | |
PerlMonks |
Re5: Optimizing a string processing subby dragonchild (Archbishop) |
on Jan 09, 2003 at 15:11 UTC ( [id://225551]=note: print w/replies, xml ) | Need Help?? |
Very good catch, MarkM!. I didn't really thoroughly test my solution, leaving that as an exercise for the reader.
As for my solution, although this wasn't in the original specs, I also wanted to solve the problem without using some variant of split (which /(.)/g is). However, I'm blanking on it. Although this may have been posted in the mainline discussion, I'll post this, as it Benchmark's faster than yours. For 1 million iterations, this benches at 74.56sec. Yours benches at 122.51sec. :-) ------ Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
In Section
Seekers of Perl Wisdom
|
|