splitting up if statements
hi,
I tried splitting up IF statements using the code in this thread:
Code:
function unrolled() {
// unrolled
timer = getTimer();
var temp = 0;
for (var i = 0; i<100000; i++) {
if (i) {
if (i) {
if (i) {
temp++;
}
}
}
}
timer = getTimer()-timer;
var_unrolled = timer;
//trace("unrolled= "+timer);
}
function rolled() {
// rolled
timer = getTimer();
var temp = 0;
for (var i = 0; i<100000; i++) {
if (i && i && i) {
temp++;
}
}
timer = getTimer()-timer;
var_rolled = timer;
//trace("rolled= "+timer);
}
http://www.headland.nl/michel/ifs.html
(fla is in same dir, ifs.fla)
Click on the 'rolled/unrolled' text to start the functions.
I find that after repeated testing, it saves me only 200-300 ms. Is that such a big deal?
another point: in the beginning of this thread Squize asked how you deal with attributes if your tile-map is only one-dimensional. I haven't found a reply to that, and I'm really curious about that. Should you store the attributes in the frame with the tile(if you use a separate tile-movieclip)?
regards and thanks for the many tips in this thread!
Thought I'd revive this monster thread...
..not sure if this stills holds true, but in previous versions of Flash, it used to be the case that if you moved all content( mainly graphics ) off all frame 1s, you see noticable speed increases.
e.g. for mcCharacter.mcStand, leave first frame blank, and stick a stop(); action on frame 2 where the GFX is.
chopsticks