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
For pixel based drawing, this checks which one is faster, [get|set]ImageData or drawRect()
<canvas id="drawRect" ></canvas>
<canvas id="imageData" ></canvas>
const drawRectCanvas = document.getElementById("drawRect");
const imageDataCanvas = document.getElementById("imageData");
drawRectCanvas.height = 100;
drawRectCanvas.width = 100;
drawRectCanvas.style.height = "100px";
drawRectCanvas.style.width = "100px";
imageDataCanvas.height = 100;
imageDataCanvas.width = 100;
imageDataCanvas.style.height = "100px";
imageDataCanvas.style.width = "100px";
const imageDataCanvasCtx = imageDataCanvas.getContext("2d");
const drawRectCanvasCtx = drawRect.getContext("2d")
imageDataCanvasCtx.clearRect(0,0,100,100)
drawRectCanvasCtx.clearRect(0,0,100,100)
const imageData = imageDataCanvasCtx.createImageData(100,100);
Ready to run.
Test | Ops/sec | |
---|---|---|
Get/SetImageData |
| ready |
Draw Rect |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.