Bootlin logo

Elixir Cross Referencer

<!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++) {
      context.font = 'bold 13px Arial';
    }
    alert('Elapsed for 1000 font settings: ' + (Date.now() - t0));
  </script>
</body>
</html>