shadowBlur-performance

JavaScript performance comparison

Test case created by Boris

Preparation code

<canvas id="c" width="640" height="480"></canvas>
<script>
  var canvas = document.getElementById('c');
  var context = canvas.getContext('2d');
  
  context.fillStyle = '#00f';
  
  function draw() {
    context.fillRect(20, 20, 150, 100);
    context.beginPath();
    context.moveTo(100, 100);
    context.lineTo(200, 100);
    context.lineTo(200, 300);
    context.lineTo(100, 100);
    context.lineTo(400, 500);
    context.lineTo(400, 300);
    context.lineTo(350, 350);
    context.lineTo(200, 300);
    context.lineTo(300, 500);
    context.closePath();
    context.stroke();
  }
</script>
      
<script>
Benchmark.prototype.setup = function() {
  context.shadowOffsetX = 0;
  context.shadowOffsetY = 0;
  context.shadowBlur = 0;
  context.shadowColor = null;
  context.clearRect(0, 0, canvas.width, canvas.height);

};
</script>

Preparation code output

<canvas id="c" width="640" height="480"></canvas>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
with shadow
context.shadowOffsetX = 5;
context.shadowOffsetY = 5;
context.shadowBlur = 4;
context.shadowColor = 'rgba(255, 0, 0, 0.5)';
draw();
pending…
without shadow
draw();
pending…

Compare results of other browsers

Revisions

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

0 Comments