Re: correct and incorrect uses of canvas

On Fri, Jul 15, 2011 at 8:11 AM, Henri Sivonen <hsivonen@iki.fi> wrote:
> On Thu, 2011-07-14 at 13:40 -0700, Jonas Sicking wrote:
>> We can and should improve the
>> SVG DOM to attract more people, but I suspect there will always be a
>> group of people that choose to use canvas anyway due to better
>> performance or other reasons.
>
> Do you have examples of people choosing <canvas> over SVG for perf
> reasons? Are the perf reasons data-based or merely assumed? Are the perf
> reasons the kind of quality of implementation issues that can be
> considered to be transient and addressed over the next couple of years?
>
> In theory, SVG should be able to outperform <canvas> for painting,
> because the browser engine gets to control how often to repaint, what
> parts to repaint and can avoid intermediate bitmaps when the path
> stroking and filling can be performed nearer hardware and there are
> guaranteed not to be readbacks because the browser knows there aren't
> filters in use.

There's discussions at these two pages:

http://andreasgal.com/2011/06/15/pdf-js/
http://blog.mozilla.com/cjones/2011/06/15/overview-of-pdf-js-guts/

It doesn't contain numbers, but it sounds like they have measured. I'm
sure that if you ask you can get details.

> So in theory, if SVG has performance issues, they should be attributable
> to the DOM. If a sub-DOM is used for accessibility in the <canvas> case,
> then the <canvas> case has a DOM, too.

Rendering a über complicated checkbox could require hundreds of DOM
objects in the SVG DOM used to render it. But only a single DOM
element in the sub-DOM representing the <input type=checkbox>.

So I would expect severely different performance.

/ Jonas

Received on Friday, 15 July 2011 22:19:22 UTC