in reply to Expanding Two demensional arrays
What do you mean 'kills'? For example, does it peg the CPU? Start swapping? What?
Depending on that answer, there may be options to help that. Or maybe not. For example, if you're swapping, DBM::Deep may help - but, in many ways, that's just swapping one part of the hard drive for another (no pun intended). How about not gluing them up until you're about to use them? e.g.,
That way, you only have the combination of one row at a time in memory, discarding when done. Or, perhaps you can destroy the original arrays as you go?for (my $i = 0; $i < scalar @arr1; ++$i) { my @garr = (@$arr1[$i], @$arr2[$i]); # do main processing on @garr here. }
At the end of this, @arr1 and @arr2 should be empty.for (my $i = 0; $i < scalar @arr1; ++$i) { @{$garr[$i]} = ( shift(@$arr1[$i]), shift(@$arr2[$i]) ); }
If you're pegging the CPU, your actual handling of @garr will peg it, too, so there's really not much I can think of for doing.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Expanding Two demensional arrays
by pigal (Novice) on Jan 30, 2007 at 11:48 UTC |