Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Canvas paths performance v94
(version: 0)
Comparing performance of:
Direct draw vs Direct with beginpath
Created:
5 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<canvas align="center" id="canvas" width="800" height="800"></canvas>
Script Preparation code:
var ctx = document.getElementById('canvas').getContext('2d'); ctx.fillStyle = 'rgba(0,1,0,1)'; var rects = [] for (var i = 0; i < 50; i++) { var width = 5 + i * 5; var height = 7 + i * 3; var path = new Path2D(); path.rect(0, 0, width, height); var rect = { x: i, y: i, width: width, height: height, cachedPath: path }; rects.push(rect); } ctx.clearRect(0, 0, 500, 500);
Tests:
Direct draw
for (var i = 0; i < rects.length; i++) { var rect = rects[i]; ctx.fillRect(rect.x, rect.y, rect.width, rect.height); ctx.fillRect(rect.x, rect.y, rect.width, rect.height); ctx.fillRect(rect.x, rect.y, rect.width, rect.height); ctx.fillRect(rect.x, rect.y, rect.width, rect.height); }
Direct with beginpath
for (var i = 0; i < rects.length; i++) { var rect = rects[i]; ctx.strokeStyle = '#000000'; ctx.lineWidth = 1; ctx.translate(rect.x, rect.y); ctx.beginPath(); ctx.rect(rect.x, rect.y, rect.width, rect.height); ctx.stroke(); ctx.translate(-rect.x, -rect.y); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Direct draw
Direct with beginpath
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Canvas paths performance
rgb vs rgba (1 & 0.5) vs hex canvas
Canvas paths performance without alpha
Canvas paths performance -fixed
Comments
Confirm delete:
Do you really want to delete benchmark?