Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
canvas style.left vs translate
(version: 1)
Comparing performance of:
translate vs left
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<canvas id="canvas" width="200" height="200" style="position: relative; border: 1px solid red"/>
Script Preparation code:
var canvas = document.getElementById("canvas"); var ctx = canvas.getContext('2d'); function draw() { ctx.beginPath(); ctx.rect(4, 4, 50, 50); ctx.lineWidth = 4 ctx.fillStyle = "green"; ctx.strokeStyle = "black"; ctx.stroke(); ctx.fill(); } draw(); var x = 0;
Tests:
translate
ctx.clearRect(0, 0, 200, 200); ctx.save(); ctx.translate(x++, 0); draw(); ctx.restore();
left
canvas.style.left = (x++) + 'px';
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
translate
left
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0
Browser/OS:
Firefox 132 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
translate
81819.2 Ops/sec
left
1405123.4 Ops/sec
Related benchmarks:
rgb vs rgba canvas
rgb vs rgba vs hex canvas
rgb vs rgba vs hex canvas
rgb vs rgba vs hex canvas
rgb vs rgba vs hex canvas
RGB vs RGBa vs HSL vs Hex using Canvas
rgb vs rgba vs hex
rgb vs rgba (1 & 0.5) vs hex canvas
Normal Line vs Rectangle Line
Comments
Confirm delete:
Do you really want to delete benchmark?