-
08-29-2003, 06:41 PM
#221
Hype over content...
You know that people who talk about it the most aren't actually having it.
I only use that term so often cause the phrase "Donkey on woman action" is hard to slip into a sentence about actionscript.
Enough spam from me.
Squize.
-
08-30-2003, 10:06 PM
#222
Heli Attack!
Check "io::pred" and PrED32 Strille =)
-
09-01-2003, 01:41 PM
#223
SaphuA
Last edited by SaphuA; 09-01-2003 at 01:48 PM.
-
09-01-2003, 01:48 PM
#224
Untitled-1.fla
Sorry SaphuA, remember: "If someone can find a Games member with a higher count before this post was posted, let me know"
I think we have to take this to the Coffee Lounge soon
-
09-01-2003, 04:00 PM
#225
SaphuA
:)
d0h!
My post was before your post... only FK was slow, and I could look in the future
-
09-02-2003, 04:50 AM
#226
SaphuA
WHY!!!!
Hey,
I was just playing with things for my ISO game and checking everything what will be slightly faster...
Now I came across this code:
code:
//---------------------------------------
time = getTimer();
var y = 0;
while (y<2000/20*40) {
y++;
}
trace("Action 1: "+(getTimer()-time)+"ms");
//---------------------------------------
time = getTimer();
var y = 0;
var yy = 2000/20*40;
while (y<yy) {
y++;
}
trace("Action 2: "+(getTimer()-time)+"ms");
//---------------------------------------
time = getTimer();
var y = 0;
while (y<2000/20*40) {
y++;
}
trace("Action 1: "+(getTimer()-time)+"ms");
//---------------------------------------
time = getTimer();
var y = 0;
var yy = 2000/20*40;
while (y<yy) {
y++;
}
trace("Action 2: "+(getTimer()-time)+"ms");
//---------------------------------------
I don't get why action 2 is slower... it should be faser, right? Xplain plz
-
09-02-2003, 05:59 AM
#227
Untitled-1.fla
It's because 2000/20*40 is never calculated at run time, it's saved in the .swf as 4000. y<4000 is faster than y<yy because in the first you have one variable and one constant while you have two variables that need to be compared in the second.
-
09-02-2003, 06:17 AM
#228
SaphuA
:)
Thnx ,
So:
code:
var bleh = 16*12/9+6; //Is pre-calculated?
Then how about:
code:
var X = 16;
var Y = 12;
var bleh = X*Y/9+6; //Is this also pre-calculated?
-
09-02-2003, 06:47 AM
#229
Untitled-1.fla
The first example is pre-calculated but I don't think the second is.
-
09-02-2003, 09:44 AM
#230
I'd actually think it was since it is not exclusivly updating x/y at any time, it simply isn't hardcoded.
RipX
-
09-02-2003, 10:38 AM
#231
Untitled-1.fla
I don't know what this proves, but if you compile a new movie with the code:
code:
var X = 16;
var Y = 12;
var bleh = 16*12/10+6;
or the code where you have calculated the value instead:
code:
var X = 16;
var Y = 12;
var bleh = 25.2;
...you get the same file size (79 bytes in my case). But this will result in a file that's 101 bytes:
code:
var X = 16;
var Y = 12;
var bleh = X*Y/10+6;
Which makes me believe that the last example is not pre-calculated but rather calculated at run time depending on X, Y.
-
09-02-2003, 10:53 AM
#232
Hype over content...
The file size is increased because the values are pulled out of variables which increases the bytecode size ( The first two snippits simply push values onto the stack, whereas the last one has to push the vars onto the stack and then get there values ).
As to pre-caluating things, it's a kinda moot point. Any value you use a lot in a loop you define outside it ( Or as much as possible ), and for any totally static value you define as a _global or in your (load) event.
Squize.
-
09-04-2003, 02:44 AM
#233
Besides all tricks within Flash, I optimize my SWFs with Flash Optimizer .That IS a good tool.
-
09-04-2003, 05:19 AM
#234
Untitled-1.fla
mannnia, are you working for SoftInfinity or something? All your posts up to this point have just been promotion of Flash Optimizer...
-
09-04-2003, 09:43 AM
#235
-
09-04-2003, 09:46 AM
#236
Hype over content...
...and I think you're getting filesize optimisation mixed up with code optimisation. As a simple rule of thumb, the faster the code the larger it is. Strange, but true
Another quick question, nothing major, I'm just curious about it. I've always been lead to believe that the maths functions in Flash are faster than using pre-calculated tables, but does anyone know if that's a 100% true ?
For anyone who doesn't understand what I'm taking about, would it be quicker to create an array full of sine values than to use Math.sin ?
No biggie, and I don't really mind not getting an answer, just curious.
Squize.
[edit]
Regards that link you just posted, point 2. Use very few -- if any -- raster graphics.. Kinda put me off reading anymore. I'd rather have a quicker running game than a quicker loading game I'm afraid.
[/edit]
Last edited by Squize; 09-04-2003 at 09:49 AM.
-
09-04-2003, 09:54 AM
#237
Untitled-1.fla
mannnia, if you're not associated in any way with Flash Optimizer then I am truly sorry. I just think it's peculiar when a new user's first four posts on the forum are revolving around the excellence of a software. I guess it's just that good. Btw, welcome to the forum!
P.S. Do you work for Sitepoint?
-
09-04-2003, 10:35 AM
#238
-
10-08-2003, 04:36 AM
#239
Optimization techniques
A few optimization hint to think about (this does NOT affect the compilers optimizations or the size of the file but rather the speed at which the same code in effect is processed at runtime where it really matters):
First, when using multiplication or division you can always improve the processing speed by using shift operators in their place.
operator clock ticks
--------------------------------------------------
multiplier 30+
divisor 90+
shift operators 3 to 6
Second, try unrolling for loops in processor intense areas. For example: a loop of 1 to 100 can be changed to 1 to 20 stepping by 5. Process the first iteration, then the second iteration+1, the third+2 etc....increment the loop by 5 and start over. This executes the same amount of code per iteration but causes that area of code to process only 20% of what it was doing prior.
-
10-17-2003, 05:34 PM
#240
Moderator FK Junkie
Optimizing Collision Detection - Discussion and Examples
That thread is from a while back, just forgot to put it in the stickes when we were done with it. Manely goes over improving FPS by optimizing collision detection, with a focus on the centralized w/ bookeeping approach.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|