in reply to Re^4: How to speed up a nested loop?
in thread How to speed up a nested loop?
My understanding is that this dumps the size of $tiles[$rx] in $tiles_for_rx, due to being a multi-dimensional array. I may be wrong there, but the debugger seems to agree.my $tiles_for_rx = $tiles[$rx];
my ($rx,$ry,$y,$x,$xScaled); my $bxScaled = $bx * 16; my $byScaled = $by * 16; my $tile_index=0; my (@realx,@realy); my ($tile); for $x ( 0..15 ) { $rx = $bxScaled+$x; my $tile = \$tiles[$bz][type][$rx]; for $y ( 0..15 ) { $ry = $byScaled+$y; if ( !defined $$tile->[$ry] || $$tile->[$ry] != $type_data[$tile_index] ) { $changed = 1; $$tile->[$ry] = $type_data[$tile_index]; } ++$tile_index; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: How to speed up a nested loop?
by kyle (Abbot) on Sep 18, 2008 at 16:32 UTC | |
by Xenofur (Monk) on Sep 18, 2008 at 16:52 UTC | |
by tilly (Archbishop) on Sep 18, 2008 at 23:04 UTC | |
by Xenofur (Monk) on Sep 19, 2008 at 09:42 UTC | |
by tilly (Archbishop) on Sep 19, 2008 at 18:51 UTC | |
|