in reply to Memory efficiency with arrays
With current versions of Perl, growing an array with push is fast. Walking through it with shift and pop is fast. (I would suspect that pop is marginally faster because it does less accounting.) With current versions of Perl it is slow to unshift. But this will change.
In short, unless you are encountering problems, don't worry about it.
(That notwithstanding, if you have to only go through it once think about whether there is any way to redesign your program to operate incrementally so you never have to have it all in memory at once.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Memory efficiency with arrays
by Dominus (Parson) on Jan 05, 2001 at 07:39 UTC |