:D
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.
Printable View
:D
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.
Check "io::pred" and PrED32 Strille =)
Hehe this is the first time I look in this threath.. finding ways to improve my code for SaphuA... sum pretty handy stuff in here :D...Quote:
Originally posted by strille
Btw Squize, I'm naming you the current champion of the use of the word "sexy" in your posts:
Saphua: 1 (381 posts)
If someone can find a Games member with a higher count before this post was posted, let me know :)
Oh and damn... are you sure I only used sexy once? I mean, I'm very sexy, atleast sexy'er then a sexy person who think's he's very sexy...
And you know what? Yesterday a sexy girl walked by... and I walked (using my sexy walk) to her, saying:
"Hey! sexy... I was just thinking, woohoo you sure are sexy" and the sexy girl walked to me (using her sexy walk asswel) and then with a smooth sexy move... SHE STOLE MY sexy HOTDOG!!!
Now that sure was NOT sexy at all...
I think it's time to update your sexy list, sexy Strille ;)
Greetz,
sexy SaphuA
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 :)
d0h!
My post was before your post... only FK was slow, and I could look in the future :rolleyes:
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 :D
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.
Thnx :D,
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?
The first example is pre-calculated but I don't think the second is.
I'd actually think it was since it is not exclusivly updating x/y at any time, it simply isn't hardcoded.
RipX
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.
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.
Besides all tricks within Flash, I optimize my SWFs with Flash Optimizer .That IS a good tool.
mannnia, are you working for SoftInfinity or something? All your posts up to this point have just been promotion of Flash Optimizer... :rolleyes:
:eek: how about that I found this tool exceptionally handy and just can't help talking about it! :D
btw, here's a good article at http://www.sitepoint.com/article/1108/ for faster Flash. These might be of no secret for those experienced in Flash, but I thought it could help, too.
Hope it's not making you think I work for Sitepoint, strille? :rolleyes:
regards,
...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]
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? :D
strille, :DQuote:
Originally posted by strille
I just think it's peculiar when a new user's first four posts on the forum ...
well, I guess I am a peculiar new user... ;)
Thanks for welcoming to the forums! ;)
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.
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.