gotty/js/spice-web-client/swcanvas/benchmark.html

31 lines
897 B
HTML
Raw Permalink Normal View History

<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script>
$( window ).load(function() {
var canvas = $('#cnv')[0];
var ctx = canvas.getContext('2d');
var loops = 0;
var startTime = +Date.now();
function drawRect() {
setTimeout(function() {
//ctx.fillStyle = '#FF0000';
//ctx.fillRect(100, 100, 100, 100);
loops++;
if(loops < 1000) {
drawRect();
} else {
var endTime = +Date.now();
alert(endTime-startTime);
}
}, 0);
};
drawRect();
});
</script>
</head>
<body>
<canvas id="cnv" width="300" height="300"></canvas>
</body>
</html>