Re: [Flashcoders] how to reduce CPU usage
There is a difference between invisible and not being rendered my friend, even if you can't see something doesn't mean its not there ;) *Fahim Akhter* |* Software Design Engineer | White Rabbit Inc* | +92.321.5307672 | akhter.fa...@gmail.com | http://apps.facebook.com/feline-frenzy/ On Thu, Mar 4, 2010 at 2:43 AM, Kerry Thompson al...@cyberiantiger.bizwrote: I'm glad you found the issue. I was about to make another suggestion--I will anyway, because it's a nice trick. Set the frame rate as low as you can, and still get smooth animation. A frame rate of about 20 fps is often good enough, and the Flash engine has to process fewer frame events. Movies at your local ciniplex only run at 24 fps, and American TV runs at just under 30 fps (29.97, I believe). Of course, that doesn't work for a lot of movies--sometimes you need the fastest frame rate you can get, especially for twitch games. Another technique I've heard of, but haven't experimented with yet, is to set the frame rate to 1 fps, and do all your rendering with updateAfterEvent. I've seen that done, and it gets some pretty impressive results. Cordially, Kerry Thompson ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to reduce CPU usage
On 3/4/2010 2:04 AM, Fahim Akhter wrote: There is a difference between invisible and not being rendered my friend, even if you can't see something doesn't mean its not there ;) Your intentions are correct, even if your terminology is not. Don't confuse the word rendered with the word processed. Rendering is the act of drawing pixels on the stage. Invisible DisplayObjects are not rendered (though alpha 0 ones are) during the render phase, but they are processed. If you have 1000 invisible sprites on the stage that aren't running code, Flash still has to keep them in memory and process them in the display stack, it just doesn't have to render them. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to reduce CPU usage
It only makes sense that Flash decompresses jpgs when it loads them. The visible property has nothing to do with that. When you say visible = true, that would be the absolute worst time to decompress the image. Imagine decompressing 1000 jpgs at once in a for loop. Imagine when setting visible = true to check whether or not the Sprite contains an image somewhere in its child stack that has not been decompressed. There's no way those are tied together. Setting visible does one thing. It prevents the pixels from drawing to the screen during the render cycle. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to reduce CPU usage
Steven Sacks wrote: Don't confuse the word rendered with the word processed. Rendering is the act of drawing pixels on the stage. Invisible DisplayObjects are not rendered (though alpha 0 ones are) during the render phase, but they are processed. If you have 1000 invisible sprites on the stage that aren't running code, Flash still has to keep them in memory and process them in the display stack, it just doesn't have to render them. Ok, I'm a little confused here. The way I understand it is that sprites with any alpha, even 0, will be rendered. Sprites with _visible == false are not rendered. Correct so far? As far as processing (aside from rendering), any jpg or other compressed format has to be processed--it has to be decompressed before it can be rendered. Is an invisible (_visible == false) sprite decompressed? Or is the Flash engine smart enough to look at the _visible flag, and skip the decompression? You could have a movie clip sprite with a dozen jpegs in it, or more. I hope that Flash doesn't decompress them all if the movie clip is not visible. I'm not quite sure what's going on under the hood there. Cordially, Kerry Thompson ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] how to reduce CPU usage
Hi Andrew... Even though you said it might not be the renderer, I wonder if you set the stage quality to medium, that might make a difference, as the anti-aliasing is processor intensive. If that degrades the text of your textfields, you could see how the fields appear using device fonts. Just a thought. - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to reduce CPU usage
It depends on a lot of factors, here are some from the top of my head: - Frame Rate - Image Raster or Vector - If using vector images are they cached? - How many vector points does the image have? - Are the objects on the screen only rendered or are vectors outside the frame being rendered wating to come in? Hope it helps :) regards, Fahim Akhter http://www.behance.net/fahimakhter http://twitter.com/fahimakhter On Wed, Mar 3, 2010 at 11:07 PM, Mendelsohn, Michael michael.mendels...@fmglobal.com wrote: Hi Andrew... Even though you said it might not be the renderer, I wonder if you set the stage quality to medium, that might make a difference, as the anti-aliasing is processor intensive. If that degrades the text of your textfields, you could see how the fields appear using device fonts. Just a thought. - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to reduce CPU usage
Thanks! Mendelsohn, Michael wrote: Hi Andrew... Even though you said it might not be the renderer, I wonder if you set the stage quality to medium, that might make a difference, as the anti-aliasing is processor intensive. If that degrades the text of your textfields, you could see how the fields appear using device fonts. Just a thought. - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to reduce CPU usage
Thanks Fahim. Could you please clarify: We're using vector images. How do I control if vectors oustide the screen are rendered? For reducing CPU usage, is it better to cache the images or not? Many of them are being cached because we're using a lot of filter effects. Fahim Akhter wrote: It depends on a lot of factors, here are some from the top of my head: - Frame Rate - Image Raster or Vector - If using vector images are they cached? - How many vector points does the image have? - Are the objects on the screen only rendered or are vectors outside the frame being rendered wating to come in? Hope it helps :) regards, Fahim Akhter http://www.behance.net/fahimakhter http://twitter.com/fahimakhter On Wed, Mar 3, 2010 at 11:07 PM, Mendelsohn, Michael michael.mendels...@fmglobal.com wrote: Hi Andrew... Even though you said it might not be the renderer, I wonder if you set the stage quality to medium, that might make a difference, as the anti-aliasing is processor intensive. If that degrades the text of your textfields, you could see how the fields appear using device fonts. Just a thought. - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to reduce CPU usage
Setting the _quality to LOW has no effect on the CPU usage, so would this point to some cause other than vector rendering? The application uses a lot of memory, about 200,000K, but this would necessarily require a lot of CPU usage, right? Lot's of apps use way more memory but not use so much CPU. Mendelsohn, Michael wrote: Hi Andrew... Even though you said it might not be the renderer, I wonder if you set the stage quality to medium, that might make a difference, as the anti-aliasing is processor intensive. If that degrades the text of your textfields, you could see how the fields appear using device fonts. Just a thought. - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to reduce CPU usage
If your application zooms into vectors and has different magnification levels, I would not recommend caching. In all other situations caching works out fine for me. Well for example , lets say you are rendering three building (vector) two of them are currently on stage ( user can see them ) the third building is offstage but is being rendered (users cannot see it ) . Its sometimes wise to just render things that you need on stage and not keep things off stage. *Fahim Akhter* |* Software Design Engineer | White Rabbit Games* | T: +92.321.5307672 | akhter.fa...@gmail.com | http://apps.facebook.com/feline-frenzy/ My profiles: [image: Facebook] http://facebook.com/fahimakhter[image: LinkedIn] http://linkedin.com/in/fahimakhter[image: Flickr]http://flickr.com/photos/fahimakhter[image: Twitter] http://twitter.com/fahimakhter[image: devianArt]http://degothicangel.deviantart.com Signature powered by WiseStamp http://www.wisestamp.com/email-install On Thu, Mar 4, 2010 at 12:17 AM, Andrew Sinning and...@learningware.comwrote: Thanks Fahim. Could you please clarify: We're using vector images. How do I control if vectors oustide the screen are rendered? For reducing CPU usage, is it better to cache the images or not? Many of them are being cached because we're using a lot of filter effects. Fahim Akhter wrote: It depends on a lot of factors, here are some from the top of my head: - Frame Rate - Image Raster or Vector - If using vector images are they cached? - How many vector points does the image have? - Are the objects on the screen only rendered or are vectors outside the frame being rendered wating to come in? Hope it helps :) regards, Fahim Akhter http://www.behance.net/fahimakhter http://twitter.com/fahimakhter On Wed, Mar 3, 2010 at 11:07 PM, Mendelsohn, Michael michael.mendels...@fmglobal.com wrote: Hi Andrew... Even though you said it might not be the renderer, I wonder if you set the stage quality to medium, that might make a difference, as the anti-aliasing is processor intensive. If that degrades the text of your textfields, you could see how the fields appear using device fonts. Just a thought. - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to reduce CPU usage
Are you using a lot of flex components on top of each other? Is it an animation? Be a little specific about what your doing so someone might find a way out :) *Fahim Akhter* |* Software Design Engineer | White Rabbit Games* | T: +92.321.5307672 | akhter.fa...@gmail.com | http://apps.facebook.com/feline-frenzy/ My profiles: [image: Facebook] http://facebook.com/fahimakhter[image: LinkedIn] http://linkedin.com/in/fahimakhter[image: Flickr]http://flickr.com/photos/fahimakhter[image: Twitter] http://twitter.com/fahimakhter[image: devianArt]http://degothicangel.deviantart.com Signature powered by WiseStamp http://www.wisestamp.com/email-install On Thu, Mar 4, 2010 at 12:37 AM, Andrew Sinning and...@learningware.comwrote: Setting the _quality to LOW has no effect on the CPU usage, so would this point to some cause other than vector rendering? The application uses a lot of memory, about 200,000K, but this would necessarily require a lot of CPU usage, right? Lot's of apps use way more memory but not use so much CPU. Mendelsohn, Michael wrote: Hi Andrew... Even though you said it might not be the renderer, I wonder if you set the stage quality to medium, that might make a difference, as the anti-aliasing is processor intensive. If that degrades the text of your textfields, you could see how the fields appear using device fonts. Just a thought. - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to reduce CPU usage
Yeah, if you have any images animating, remove the caching, as it has to cache every time it moves. Also, if you have any listeners that can be deleted after being called, do that as well. Karl On Mar 3, 2010, at 1:37 PM, Fahim Akhter wrote: If your application zooms into vectors and has different magnification levels, I would not recommend caching. In all other situations caching works out fine for me. Well for example , lets say you are rendering three building (vector) two of them are currently on stage ( user can see them ) the third building is offstage but is being rendered (users cannot see it ) . Its sometimes wise to just render things that you need on stage and not keep things off stage. *Fahim Akhter* |* Software Design Engineer | White Rabbit Games* | T: +92.321.5307672 | akhter.fa...@gmail.com | http://apps.facebook.com/feline-frenzy/ My profiles: [image: Facebook] http://facebook.com/fahimakhter[image: LinkedIn] http://linkedin.com/in/fahimakhter[image: Flickr]http://flickr.com/photos/fahimakhter[image: Twitter] http://twitter.com/fahimakhter[image: devianArt]http://degothicangel.deviantart.com Signature powered by WiseStamp http://www.wisestamp.com/email-install On Thu, Mar 4, 2010 at 12:17 AM, Andrew Sinning and...@learningware.comwrote: Thanks Fahim. Could you please clarify: We're using vector images. How do I control if vectors oustide the screen are rendered? For reducing CPU usage, is it better to cache the images or not? Many of them are being cached because we're using a lot of filter effects. Fahim Akhter wrote: It depends on a lot of factors, here are some from the top of my head: - Frame Rate - Image Raster or Vector - If using vector images are they cached? - How many vector points does the image have? - Are the objects on the screen only rendered or are vectors outside the frame being rendered wating to come in? Hope it helps :) regards, Fahim Akhter http://www.behance.net/fahimakhter http://twitter.com/fahimakhter On Wed, Mar 3, 2010 at 11:07 PM, Mendelsohn, Michael michael.mendels...@fmglobal.com wrote: Hi Andrew... Even though you said it might not be the renderer, I wonder if you set the stage quality to medium, that might make a difference, as the anti-aliasing is processor intensive. If that degrades the text of your textfields, you could see how the fields appear using device fonts. Just a thought. - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Karl DeSaulniers Design Drumm http://designdrumm.com ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to reduce CPU usage
Karl DeSaulniers wrote: Yeah, if you have any images animating, remove the caching, as it has to cache every time it moves. Also, if you have any listeners that can be deleted after being called, do that as well. Animating as in not being just moved around without changing the size, rotation or skew. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to reduce CPU usage
Things are looking much better. I had made a really stupid interface kludge when somebody decided that we needed a layered-tab look. I took the main display layer, duplicated it 5 times, and then used depth swapping to change the current display item. We've since dropped the layered-tab look, but the structure is still in place. As a quick test, I got rid of all but the most important display layer, and my CPU usage dropped to 12%! What's odd to me is that all of this CPU is getting used even though these movie clips are completely invisible. The GUI does use a lot of filters, so in an earlier test I removed all of the filters (at runtime). This didn't have any effect on CPU usage at all. Fahim Akhter wrote: Are you using a lot of flex components on top of each other? Is it an animation? Be a little specific about what your doing so someone might find a way out :) *Fahim Akhter* |* Software Design Engineer | White Rabbit Games* | T: +92.321.5307672 | akhter.fa...@gmail.com | http://apps.facebook.com/feline-frenzy/ My profiles: [image: Facebook] http://facebook.com/fahimakhter[image: LinkedIn] http://linkedin.com/in/fahimakhter[image: Flickr]http://flickr.com/photos/fahimakhter[image: Twitter] http://twitter.com/fahimakhter[image: devianArt]http://degothicangel.deviantart.com Signature powered by WiseStamp http://www.wisestamp.com/email-install On Thu, Mar 4, 2010 at 12:37 AM, Andrew Sinning and...@learningware.comwrote: Setting the _quality to LOW has no effect on the CPU usage, so would this point to some cause other than vector rendering? The application uses a lot of memory, about 200,000K, but this would necessarily require a lot of CPU usage, right? Lot's of apps use way more memory but not use so much CPU. Mendelsohn, Michael wrote: Hi Andrew... Even though you said it might not be the renderer, I wonder if you set the stage quality to medium, that might make a difference, as the anti-aliasing is processor intensive. If that degrades the text of your textfields, you could see how the fields appear using device fonts. Just a thought. - Michael M. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
RE: [Flashcoders] how to reduce CPU usage
What's odd to me is that all of this CPU is getting used even though these movie clips are completely invisible. Invisible as in visible = false, or alpha = 0? Rendering alpha at anything under 100% is quite cpu intensive. Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to reduce CPU usage
You could remove from the display tree or do the visible = false thing to help out. On Wed, Mar 3, 2010 at 4:09 PM, Keith Reinfeld keithreinf...@comcast.netwrote: What's odd to me is that all of this CPU is getting used even though these movie clips are completely invisible. Invisible as in visible = false, or alpha = 0? Rendering alpha at anything under 100% is quite cpu intensive. Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders -- http://ericd.net Interactive design and development ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to reduce CPU usage
as in: _visible = false; Keith Reinfeld wrote: What's odd to me is that all of this CPU is getting used even though these movie clips are completely invisible. Invisible as in visible = false, or alpha = 0? Rendering alpha at anything under 100% is quite cpu intensive. Regards, Keith Reinfeld Home Page: http://keithreinfeld.home.comcast.net ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] how to reduce CPU usage
I'm glad you found the issue. I was about to make another suggestion--I will anyway, because it's a nice trick. Set the frame rate as low as you can, and still get smooth animation. A frame rate of about 20 fps is often good enough, and the Flash engine has to process fewer frame events. Movies at your local ciniplex only run at 24 fps, and American TV runs at just under 30 fps (29.97, I believe). Of course, that doesn't work for a lot of movies--sometimes you need the fastest frame rate you can get, especially for twitch games. Another technique I've heard of, but haven't experimented with yet, is to set the frame rate to 1 fps, and do all your rendering with updateAfterEvent. I've seen that done, and it gets some pretty impressive results. Cordially, Kerry Thompson ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders