Is canvas faster than a normal image?

So If I have for example an image like this:

Will it load faster if its written in JS, in canvas? Or is it faster to have it in PNG or JPG or GIF?


That depends on your network latency, and for images of nontrivial size, on the bandwidth available both on your server's end and on the user's end. High latency and low bandwidth would increase the odds that a canvas-based solution would be faster.

Canvas-based image drawing speed also varies drastically betweeen browsers. Here are some fairly outdated results:

Since then Chrome has advanced 4 versions, the Firefox team has put a lot of work into performance in Firefox 4, and IE9 has arrived with hardware acceleration. But it can give you an idea of the variability at least.

Need Your Help

Navigating html directories with swig templating engine?

html node.js mongodb express swig-template

I have 2 different directories inside one directory. The first is views which contains all swig views such as newpost.html. The other is temp_images which contains butterfly.png.

Detect iframe src change using jquery

javascript jquery html iframe

Lets say an <iframe> is initially loaded pointing to a certain src. The user clicks on a hyperlink and the contents of the iframe changes.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.