swf extremely intense on CPU

Go To StackoverFlow.com

1

If anyone's seen me posting lots of questions about this project in the past couple days, I greatly appreciate everyone's help. Having lots of trouble and deadline is coming up soon.

The sample file (fla and swf) is located here:

http://www.mediafire.com/download.php?ejy6j9h9r1c1829

If you load the .swf, it's super intense on the cpu and ram usage and I don't know how to fix it. That .swf at the link above is only loading two videos, in which my real one is loading about 45 videos (totaling 78MB) and they're both using about the same cpu usage. The one loading more videos is using nearly 1GB of ram as well.

I don't know how to find what the main problem is. I've been having lots of help, so the code isn't optimized or refactored at all. It's repeatedly calling a php file every three seconds (flashpull.php) to check for a variable in a database on my server. When I inspected the local storage, it was infinitely putting more and more "flashpull.php" files on the server, but that file is only 2KB and i dont think that would cause the swf to be as intensive as it is. Is there a way I can keep checking that file, but overwrite the local storage copy, or is that even a big deal?

I'm using greensock to load all the videos, I have maxConnections set at 6, don't know if that affects it.

I'm really hoping there's a glaring problem or memory leak, instead of the overall file just being so bloated that it's causing such bad performance. ANY help is greatly appreciated, thanks

2012-04-05 01:23
by ahainen
Sorry, I posted a link to an fla and swf that has the full code. Please let me know what I need to supply you with and I will. It's all framescript, majority of the code is on frame 1 and on frame 1 inside the symbol rewinder. The swf is currently online at www.helpg.us, but that site hasn't been publicly advertised yet and I'm trying to fix this memory problem before I post that everywhere. I know it seems like "hey, solve my problem for me", but if you could point me in ANY direction of where the memory problem might be, I can keep trying. Right now im totally stuck - ahainen 2012-04-05 03:17
Ascension: like nearly all Flash content this is render-bound, so VM performance is neither here nor there - fenomas 2012-04-05 03:31
let us continue this discussion in chatNoName 2012-04-08 06:56


2

You seem to have a 3D rotation applied to your video container. On the stage, select the clip "rewinder", and in Property Inspector -> 3D position you'll see a Y rotation of -1. That means that every frame, Flash is rendering your video into a bitmap and applying a slight 3D transformation. Which is very costly, and I have a feeling, not intended. ;)

To fix, Modify > Transform > Remove transform (ctrl-shift-Z). Or just setting the Y rotation back to zero should work as well.

2012-04-05 03:40
by fenomas
OH MY GOD YES, thank you so much for spotting that. Literally dropped ~%30 off the cpu usage. Cant thank you enough, I never would have spotted that - ahainen 2012-04-05 03:51
I'm seriously giddy now, its working so much better. THANK YOU! - ahainen 2012-04-05 03:52
Glad it helped! I wish I could say there's an easy way to spot problems like this, but the only way I noticed it is that I selected the clip and recognized the little "3D axes" marker that shows up when a clip has a 3D rotation on it - fenomas 2012-04-05 03:58
yeah, i should have noticed that, sitting right in the center of the screen lol. It's running way better, RAM usage is still really high, but cpu is at around 60% as opposed to 95%. thanks agai - ahainen 2012-04-05 04:01
Hmm, well it makes total sense that that transform would be a problem, but its kinda around 85% after i look at it again, same RAM usage too. It does seem to run better though? Not sure (and clearing the cache of course - ahainen 2012-04-05 05:31
@ahainen: Are you looking at CPU/memory usage in the task manager or similar? That's not generally a reliable way to judge performance. Add some code to your SWF monitor FPS (I like net.hires.debug.Stats), then set the content framerate to 60fps, publish, and see what kind of FPS it sustains - fenomas 2012-04-05 14:03
I was looking in the Activity monitor on Mac (task manager equivalent). Trying to get net.hires.debug.Stats to work. Do I just save that as Stats.as, put it in the folder hierarchy net>hires>debug and then put the addChild in my fla framescript? Can't get it to work - ahainen 2012-04-05 15:37
Yes, typically you just import the class and add addChild( new Stats() ); somewhere appropriate. Are you getting an error? If you're just not seeing it, it might be underneath something else.. try making a movieclip for stats, adding the code inside, and putting that MC on top of everything else on the stage - fenomas 2012-04-06 09:56
Hey fenomas, thanks for all your help - I got Stats() working, but after working with my friend on the project, we found a small issue that was causing things to not unload videos. When I was navigating backwards it wasn't checking to load the videos in front of it. The project is up and online at www.helpg.us. Thanks again for your help, I greatly appreciate it - ahainen 2012-04-09 12:44
Ads