All,
I've been developing Flash applications for several years, and here's something I've always wondered about.
I try to be as careful as possible about minimizing the amount of "overhead" that my application uses. (By overhead, I generally mean RAM, cpu processing effort, downloaded data, etc.) My goal is to consume as little of the user's PC resources as possible.
So, I'm careful to:
- include the fewest classes possible
- minimize the scope of arrays, references, variables, etc
- remove unnecessary clips, rather than hide them
- minimize the number of fonts, and embed only the glyphs I actually need
- carefully select graphics, and compress them as much as possible
- etc.
(I know, I know... here's where all the anti-Flash folks chime in and say, "How 'bout not using Flash!")
Are there any rough guidelines about how much overhead various screen elements consume?
- movie clips
- static text
- dynamic text
- buttons
- etc
For example... Let's say I have a screen element that might need to change based on the application's state. Is it less resource intensive to make it a dynamic text field than a movie clip?
Or, I'll often spend extra time creating complex screens with Actionscript rather than creating them in design-time in the IDE, because I naively believe that code is more compact/less overhead than elements pre-placed on the stage.
Or, for static elements, I typically use static text because I naively believe that it's less resource intensive than a dynamic text field. However, using a dynamic text field gives me extra flexibility than I might appreciate down the road in subsequent versions. Am I really saving anything here?
Or, what about buttons vs. movie clips? What about "device fonts" vs. "bitmap fonts" vs "anti-alias for animation" vs. "anti-alias for readability"?
I'll typically use the Task Manager's performance monitor, but it doesn't seem very sensitive to small changes, and it's hard to create controlled before/after comparisons.
Also important - I assume that a movieclip has more overhead than a static text field. However, is the difference at all worth worrying about? Am I wasting programming time trying to save a few bytes/CPU cycles that no one will ever notice?
A good analogy... I used to be incredibly careful about how I stored data. But now, storage is so cheap that it's not worth worrying about. It's far more important to focus on performance, maintainability, etc.
So - in Flash - is it worth spending hours trying to trim the number of clips from 500 to 400? Or, is the difference insignificant?
I appreciate that the circumstances matter - a few KB of "page weight" on Amazon.com or Twitter.com matter a lot more than on a site that gets a few hundred visitors a month. But in general, are there good tools to measure this type of thing? Good guidelines?
Many thanks in advance!