Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
canvas clearRect vs fillRect vs resize
Testing performance between clearRect and fillRect on a canvas.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36
Browser:
Chrome 146
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
5 months ago
Benchmark engine:
Benchmark.js
clearRect
10.3M/s
fillRect
9.2M/s
resize
2.0M/s
View exact numbers
Test name
Executions per second
✓
clearRect
10,259,030 Ops/sec
fillRect
9,239,176 Ops/sec
resize
1,955,062 Ops/sec
Script Preparation code:
var width = 2560; var height = 1300; var canvas = document.createElement("canvas"); canvas.width = width; canvas.height = height; var ctx = canvas.getContext("2d"); document.body.appendChild(canvas); ctx.fill = 'black';
Tests:
clearRect
ctx.clearRect(0, 0, width, height);
fillRect
ctx.fillRect(0, 0, width, height);
resize
canvas.width = width; canvas.height = height;