With your changes i'm at the following code and have a real life application improvement from 0.055 seconds for a whole "syncToDF" loop down to 0.049, which is already pretty respectable. Additionally you've helped show me where i need to keep my eyes open. Thanks a lot! :D
my ($tile_index,$rx,$ry,$y,$x,$xScaled);
my $bxScaled = $bx * 16;
my $byScaled = $by * 16;
for $x ( 0..15 ) {
$rx = $bxScaled+$x;
$xScaled = 16 * $x;
for $y ( 0..15 ) {
$tile_index = $y+$xScaled;
$ry = $byScaled+$y;
if (
!defined $tiles[$rx][$ry][$bz][type] ||
$tiles[$rx][$ry][$bz][type] != $type_data[$tile_index]
) {
$changed = 1;
$tiles[$rx][$ry][$bz][type] = $type_data[$tile_index];
}
}
}
Now to see whether there's some more good hints. :)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.