canvas-clearRect-size (v5)

Revision 5 of this benchmark created by Kashey on


Description

clear rect vs width

Preparation HTML

<script>
  var c = document.createElement('canvas');
  c.width = c.height = 256;
document.body.appendChild( c );
  var ctx = c.getContext('2d');
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
clearRect
  ctx.clearRect(0, 0, 256,256);
 
ready
clearRect self
ctx.clearRect(0, 0, c.width, c.height);
ready
clearWidth
c.width = 0;
c.width = 256;
ready
clearWidth self
c.width=256
ready

Revisions

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