Hi Tom, On Sat, Mar 2, 2013 at 6:11 PM, Tom Brazil <tom.bra...@systar.com> wrote:
> Rather amazing work. Good job. > thanks! > However, what can be done about the massive difference in cpu utilization? > The flash version used so little cpu that it wasn't noticeable, whereas > the html5 version pegs a cpu at 40% minimum continuously, and on some > charts 100% continuously - even when nothing is happening (non debug > version too). > Is that an artifact of this particular demo, an artifact of html5, or the > way things would be for all applications using this approach? > I'd say it is an artifact of some parts of the JooFlash implementation. I recently changed the rendering strategy to better match the one of original Flash. JooFlash now also renders in a frame-based manner. When the application code changes a property of some object on the display list, this value is stored and a "dirty" flag is set. Then, on the next frame render event, every sub-tree of the display list that has a "dirty" child is re-rendered. So for one, there are still some bugs where a "dirty" flag is set although nothing changed (100% CPU even when nothing is happening), e.g. when the application code sets a value to the old value (e.g. setFoo(true) when foo is already true). So this causes unneeded re-rendering of the whole stage all the time. The other potential for performance improvement is to introduce redraw areas like the Flash engine does. This would allow to start redrawing from the top of the display list, but skip rendering of all display objects that are completely located outside the redraw areas. The third way to tweak performance is to play with the "cacheAsBitmap" flag of display object containers. JooFlash uses a canvas for every DOC that has this flag set. This can improve performance, if that subtree is not or rarely changed, but may also decrease performance if for example some object in this subtree is modified on every frame (e.g. rotated), because this causes the whole subtree to be re-rendered all the time. So to conclude, JooFlash is still in an early stage, and there is a high performance improvement potential. I didn't even mention WebGL or the like... Greetings -Frank-