in reply to Sloooooow algo in Perl

Presizing the arrays can offer a performance improvement. Continually pushing things onto the stack can be inefficient when working w/ large arrays.

Replies are listed 'Best First'.
Re^2: Sloooooow algo in Perl
by tilly (Archbishop) on Mar 28, 2005 at 19:29 UTC
    Can you offer an example where this inefficiency is significant?

    Perl's dynamic allocation algorithm is designed so that the average cost of resizing and reallocating works out to be a constant amount per push. I'm not sure that avoiding that cost only to have to keep track of what index you're on will be a win.