Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Canvas gradient perf
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0
Browser:
Chrome 123
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Create
22612.3 Ops/sec
reuse
26223.1 Ops/sec
HTML Preparation code:
<canvas id="canvas1" width="512" height="512"></canvas> <style> canvas { border: 1px solid black; } </style> <script> var canvas = document.getElementById('canvas1'); var ctx = canvas.getContext('2d'); var grad = ctx.createLinearGradient(0, 0, 1, 512); grad.addColorStop(0, 'red'); grad.addColorStop(0.5, 'rgba(0,0,255,0.5)'); grad.addColorStop(1, 'lime'); </script>
Tests:
Create
for (var i = 0; i < 10; i++) { var grad2 = ctx.createLinearGradient(0, 0, 1, 512); grad2.addColorStop(0, 'red'); grad2.addColorStop(0.5, 'rgba(0,0,255,0.5)'); grad2.addColorStop(1, 'lime'); ctx.fillStyle = grad2; ctx.fillRect(0,0,512,512); }
reuse
for (var i = 0; i < 10; i++) { ctx.fillStyle = grad; ctx.fillRect(0,0,512,512); }