Hacker News new | past | comments | ask | show | jobs | submit login

The standard Canvas API is probably your best option. So if some library claims to have better performance than Canvas 2D, I would love to see a benchmark on that. Anyone would assume WebGL is faster, but as you know "assumption is the mother of all fuckups". Let me explain.

A year ago, I had to make a proof of concept for drawing Gantt charts on a Canvas. Coming from a game development background, my assumption was that some things would be too slow on a canvas:

- rotating graphics

- drawing an insane amount of rectangles

- filling surfaces with a certain repeating texture

So I also included a benchmark of Canvas vs WebGL. The conclusion was that for most things, Canvas was faster:

- rotating graphics

- texturizing

- etc.

This really amazed me, because as an old school game developer, I know all limitations of 2D rendering. The thing is, all modern browsers heavily optimize their Canvas to the GPU. Even the older Edge. Do some heavy Canvas 2D drawing, and see your GPU usage spikes.

Plus, rendering text on WebGL is not as straightforward.

However, there was a tipping point when drawing an insane amount of rectangles (which basically become dots), where WebGL would take over.

So for this project, the simplicity of the Canvas API, the text rendering, and the performance were definitely a sure way to use that one instead of a more complex, slower WebGL.




The link points to a C++ library that provides accelerated drawing of 2D shapes, apparently intended to be used for UI rendering.

This is not about HTML5 Canvas vs something WebGL based.

A browser could theoretically use this tough to implement Canvas elements. See this issue: https://github.com/intel/fastuidraw/issues/50




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: