Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Setting Canvas Pixel With Same Color
(version: 0)
Comparing performance of:
fillRect vs 1×1 Image Data
Created:
4 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<canvas id="c" width="800" height="300"></canvas>
Script Preparation code:
$c = document.getElementById('c'); $ctx = $c.getContext('2d'); $ctx.clearRect(0, 0, 800, 300); $px = $ctx.createImageData(1, 1); $pxls = []; for (var i=0; i<10000; ++i) $pxls.push({ x: Math.random() * 800 << 0, y: Math.random() * 300 << 0 }); $i = 0;
Tests:
fillRect
$ctx.fillStyle = 'rgba(128, 128, 128, 1)'; for (var i=500;i--;){ var px = $pxls[$i++ % 10000]; $ctx.fillRect(px.x, px.y, 1, 1); }
1×1 Image Data
for (var i=500;i--;){ var px=$pxls[$i++ % 10000], d=$px.data; d[0] = 128; d[1] = 128; d[2] = 128; d[3] = 1; $ctx.putImageData($px, px.x, px.y); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
fillRect
1×1 Image Data
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:
Setting Canvas Pixel
Setting Canvas Pixel
Setting Canvas Pixel with lots of iterations - looking more at get/put
Setting multiple canvas pixels
Comments
Confirm delete:
Do you really want to delete benchmark?