in reply to How to speed up a nested loop?
You'd be better off if you'd rearrange your data structure so that you could use strings of 256 bytes (or whatever is big enough for what you are assigning) and string bit ops.
$changed = ~$defined | ($type ^ $new); $type = $new; $defined = "\xFF" x 256;
But since you since you provided no information about your data structure — What are $bz, tile and the data you are assining, and why do you add $bx+16 and $by+16 — can't help you beyond that.
Update: Oops, the sample code I provided worked at the bit level, not the byte level. And I can't think of a good way to do it at the byte level at the moment.
Why aren't you using PDL anyway?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to speed up a nested loop?
by Xenofur (Monk) on Sep 18, 2008 at 09:26 UTC | |
by andreas1234567 (Vicar) on Sep 18, 2008 at 10:59 UTC | |
by etj (Priest) on Jun 06, 2022 at 00:53 UTC | |
by Xenofur (Monk) on Sep 18, 2008 at 18:32 UTC |