With current versions of Perl it is slow to unshift.
It's probably also worth pointing out that unshift is fast if the array has previously been shifted. The shift leaves a gap at the beginning of the memory block, and when you unshift, Perl sticks the new data into the gap.
In reply to Re: Memory efficiency with arrays
by Dominus
in thread Memory efficiency with arrays
by Hot Pastrami
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |