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
performace of getImageData (html5 canvas) in function of the size of data requested.
getImageData is slow, whatever the size of the canvas and of the requested frame.
<script language="JavaScript">
var canvas = document.createElement("canvas");
var smallCanvas = document.createElement("canvas");
w = canvas.width = 2000;
h = canvas.height = 2000;
ws = smallCanvas.width = 20;
hs = smallCanvas.height = 20;
document.body.appendChild(canvas);
ctx = canvas.getContext("2d");
smallCtx = smallCanvas.getContext("2d");
var imgdata = ctx.createImageData(2000,2000);
var data = imgdata.data;
for(var i=0;i<data.length;i++){
data[i] = Math.floor(Math.random()*255);
}
ctx.putImageData(imgdata,0,0);
</script>
<style>
canvas{width:256px;height:256px;}
</style>
Ready to run.
Test | Ops/sec | |
---|---|---|
topleft 10*10 square |
| ready |
bottomleft 10*10 square |
| ready |
100*100 square |
| ready |
1000*1000 square |
| ready |
2000*2000 square |
| ready |
10*10 square on a small (20*20) canvas |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.