in reply to Fast Way to Split String in to Chunk of Equal Length
unpack is the way to go, but one tip is that unpack 'a3' x $n, $str runs a few percent quicker than unpack '(a3)*', $str if you know in advance how many fields there are.
Also, if your problem allows you to unpack the strings just in time at the point where you need them, rather than en masse, avoiding the allocation, creation and destruction of 10 million concurrent small arrays -- even if you have ample memory for them -- can save a significant amounts of time.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Fast Way to Split String in to Chunk of Equal Length
by ikegami (Patriarch) on Nov 25, 2011 at 17:09 UTC | |
by BrowserUk (Patriarch) on Nov 25, 2011 at 17:20 UTC | |
by BrowserUk (Patriarch) on Nov 25, 2011 at 20:23 UTC |