Re: SVG vs canvas performance

On 7/17/2011 7:07 AM, Karl Dubost wrote:
> Le 16 juil. 2011 à 07:29, Robert O'Callahan a écrit :
>> I'm very doubtful they'll ever be as fast in SVG as in canvas, especially if
>> the canvas code has been hand-optimized to use explicit tiling.
> Just by curiosity because I'm not knowledgeable enough. Do you think it could be faster if it was fish as 3D object (VRML type) instead of 2D object (multiple SVG)?
SVG and Canvas 2d -can- be optimized to run particular actions directly 
to the GPU.

Canvas 2d and SVG implementations can mipmap patterns intelligently.
drawImage and  createPattern+fillRect have two very different consequences.

Here's someone taking the fish scene and running it on WebGL on 
supporting hardware:
http://muizelaar.blogspot.com/2011/02/drawing-sprites-canvas-2d-vs-webgl.html

WebGL has -not- been approved by all of the vendors, but it is available 
in a few browsers,
and for anything but the low-end graphics cards [usually embedded into 
low-end laptops],
WebGL can run on the GPU.

When it comes to the -best- performance of a Fish scene
a WebGL scene is going to be the optimal solution; it'll use the least 
CPU and the most GPU.

That's similar to the VRML type you're describing.

In the future, If Canvas 2d and SVG pick up support for ArrayBuffers, we 
could skip WebGL for simple tasks.
Pseudo-code examples:

ctx.drawImage(img, ArrayBuffer)
Object.parallel(ctx.drawImage, ArrayBuffer);
svgPoly.points = ArrayBuffer;
svgPoly.scale = ArrayBuffer;

-Charles

Received on Sunday, 17 July 2011 19:29:44 UTC