jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
Tests toDataURL image types with a large canvas
<canvas id="canvas" width="1280" height="720" style="width:1280px; height:720px;">
</canvas>
c = document.getElementById("canvas");
ctx = c.getContext("2d");
cpa = ctx.createImageData(1280, 720);
for (var i = 0; i < 1280 * 720; i++) {
cpa.data[i * 4 + 0] = Math.round(Math.random() * 255);
cpa.data[i * 4 + 1] = Math.round(Math.random() * 255);
cpa.data[i * 4 + 2] = Math.round(Math.random() * 255);
cpa.data[i * 4 + 3] = 255;
}
ctx.putImageData(cpa, 0, 0);
HTMLCanvasElement.prototype.toBlobAsync = function(type, quality) {
var dataURL = this.toDataURL(type, quality),
binary = atob( dataURL.substr( dataURL.indexOf(',') + 1 ) ),
i = binary.length,
view = new Uint8Array(i);
while (i--) {
view[i] = binary.charCodeAt(i);
}
return view;
};
Ready to run.
Test | Ops/sec | |
---|---|---|
getImageData |
| ready |
toBlobAsync image/jpeg 1.0 |
| ready |
toBlobAsync image/jpeg 0.8 |
| ready |
toBlobAsync image/png |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.