blob: 8a21cf3f31c304f8bdc1a64e4b46a5591441cbe6 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Canvas 2d Context Font Property Speed</title>
</head>
<body>
<canvas id='thecanvas' height=100 width=100/>
<script>
var canvas = document.getElementById('thecanvas');
var context = canvas.getContext('2d');
var t0 = Date.now();
for (var i = 0; i < 1000; i++) {
if(i % 2 == 0)
context.font = 'bold 13px Arial';
else
context.font = 'italic 13px Arial';
}
alert('Elapsed for 1000 font switches: ' + (Date.now() - t0));
</script>
</body>
</html>