I was just finished a new version of the Company Chart application when I recieve an e-mail from the client that when the chart have more items he get more than 50% CPU load and it rises above 80% on some points. This happens even without any interaction with the application - when you just keep the cursor in the application window CPU load in over 10%, if you move the cursor the load rise to over 50%. I lost several hour to look at the common issues in such situations - EnterFrame`s, neverending cycles and so on, but I didn`t find any, moreover in this version the whole code was passed an optimisation procedure.
It turned out that the problem actually is not a problem, just Flash Player takes serious resources to handle large quantitys of vector graphics /all of the graphics are vector in the application/, even if it dont do anything with them, but simply visualize.
The solution is cacheAsBitmap. The result was significant - CPU usage at times when previously reached 50%, now ranged between 2%-8%, and overall application did not exceed 12-15% workload at peak times.
/ Here to make it clear, those results are on machine: Pentium4 Dual Core Processor on 3.4 GHz, RAM - 1GB, NVIDIA GForce7300LE graphic card./
If you generate graphs with a code, for the MovieClip that contains them just add this line:
myMovieClip.cacheAsBitmap = true;
If you made the MovieClips in the Flash graphic environment, in the panel Properties -> Display you have to select the checkbox - Cache as bitmap.
I hope this info is helpful.




