Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Roundrect perf comparison check 2
(version: 1)
Comparing performance of:
Custom roundRect vs roundRect vs rect
Created:
5 months ago
by:
Guest
Go to the latest result
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'); </script>
Tests:
Custom roundRect
function roundRect(canvas, x, y, w, h, r) { if (w < 2 * r) r = Math.round(w / 2); if (h < 2 * r) r = Math.round(h / 2); canvas.beginPath(); canvas.moveTo(x + r, y); canvas.arcTo(x + w, y, x + w, y + h, r); canvas.arcTo(x + w, y + h, x, y + h, r); canvas.arcTo(x, y + h, x, y, r); canvas.arcTo(x, y, x + w, y, r); canvas.closePath(); canvas.fill(); } roundRect(ctx, 10, 10, 200, 100, 20);
roundRect
ctx.beginPath(); ctx.roundRect(10, 10, 200, 100, 20); ctx.fill();
rect
ctx.beginPath(); ctx.rect(10, 10, 200, 100); ctx.fill();
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Custom roundRect
roundRect
rect
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
5 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36 Edg/145.0.0.0
Browser/OS:
Chrome 145 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
rect
1.6M/s
Custom roundRect
235K/s
roundRect
192K/s
View exact numbers
Test name
Executions per second
✓
rect
1,620,598 Ops/sec
Custom roundRect
234,513 Ops/sec
roundRect
191,908 Ops/sec
Related benchmarks
alpha false
canvasperf
Canvas cache or Path 2D (updated)
Canvas roundrect perf
Canvas roundrect perf comparison check
Roundrect perf comparison check
Canvas roundrect vs fillrect perf
Comments
Confirm delete:
Do you really want to delete benchmark?