Keep It Simple, Stupid | |
PerlMonks |
Re: Fast Way to Split String in to Chunk of Equal Lengthby davido (Cardinal) |
on Nov 25, 2011 at 08:11 UTC ( [id://939995]=note: print w/replies, xml ) | Need Help?? |
Are you sure that chunking the strings is where your performance bottleneck is? Have you profiled? Could IO be a more significant constraint to execution time? I only ask because it doesn't seem like the performance of substr for 10,000,000 strings is all that bad for the problem domain. If this section of code is really significant, here's a comparison of the valid solutions provided up to this point in the thread. Naturally unpack wins. It's only a few seconds slower in 10,000,000 iterations than the "control" case (which isn't a solution, but just a check to see what the framework for each solution costs).
Here's the output.
By the way: This question was crossposted to StackOverflow here. Dave
In Section
Seekers of Perl Wisdom
|
|