html vs svg vs canvas (v4)

Revision 4 of this benchmark created on


Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

Setup

var canvas = document.createElement('canvas');
    var svg = document.createElementNS("http:/ / www.w3.org / 2000 / svg ", 'svg');
    var divtest = $(document.createElement('div'));

Test runner

Ready to run.

Testing in
TestOps/sec
canvas
var paper = canvas.getContext('2d');
paper.fillRect(10, 10, 50, 50);
ready
svg
var rect = document.createElementNS("http://www.w3.org/2000/svg", 'rect');
rect.setAttribute("x", 10);
rect.setAttribute("y", 10);
rect.setAttribute("width", 50);
rect.setAttribute("height", 50);
svg.appendChild(rect);
ready
div
var div = divtest.append("<div></div>")
div.css({
  position: "absolute",
  top: "10px",
  left: "10px",
  width: "50px",
  height: "50px"
});
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.