html vs svg vs canvas (v5)

Revision 5 of this benchmark created on


Preparation HTML

<script src="https://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 container = document.createElement('div');
  var motherDiv = document.createElement('div');

Teardown



            container.innerHTML = '';
        
  

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 = motherDiv.cloneNode();
div.style.position = "absolute";
div.style.top = "10px";
div.style.left = "10px";
div.style.width = "50px";
div.style.height = "50px";
container.appendChild(div);
ready

Revisions

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