[whatwg] [2D Canvas] Proposal: batch variants of drawImage

Greetings all,

In a drive to satisfy some the most demanding performance critical
applications--2d platformer games--, browser vendors have put a lot of
effort into optimizing CanvasRenderingContext2D, and the drawImage method
in particular. In a world where browsers have GPU-accelerated graphics
backends and complex multi-threaded rendering frameworks, the ultimate
hurdle in relieving computational burden from the browser's main thread is:
per draw call overhead.

In a sprite based animation, the application may be calling drawImage
hundreds or even thousands of times per animation frame. The script
bindings and browser internal bookkeeping that is performed on a per draw
call basis is a O(N) cost that could be made O(1) by introducing batch
versions of drawImage. Benchmark experiments performed using Chrome on
mobile and desktop platforms show that this is currently the main obstacle
standing in the way of achieving near-native rendering performance.

Here is what I am proposing:
http://wiki.whatwg.org/wiki/Canvas_Batch_drawImage

Feedback wanted.

Cheers,

   -Justin Novosad

Received on Monday, 4 August 2014 18:05:40 UTC