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 different methods of manipulating pixels using the canvas. *Removed non-performant fillRect & 1px canvas, renamed snippets.

`<canvas id="canvas" height="256" width="256"></canvas>`

```
//precompute everything to only test raw pixel pushing performance
var canvas = document.getElementById('canvas'),
canvasWidth = canvas.width,
canvasHeight = canvas.height,
ctx = canvas.getContext('2d'),
imageData = ctx.getImageData(0, 0, canvasWidth, canvasHeight),
data = imageData.data,
buf = new ArrayBuffer(data.length),
buf8 = new Uint8ClampedArray(buf),
data32 = new Uint32Array(buf),
pixelsI32 = new Int32Array(data.buffer),
pixelsU32 = new Uint32Array(data.buffer),
view = new DataView(data.buffer),
temp = ctx.createImageData(canvasWidth, canvasHeight),
tempData = temp.data,
r = [],
g = [],
b = [],
a = [],
b32 = [],
v32 = [];
for (var y = 0; y < canvasHeight; y++) {
for (var x = 0; x < canvasWidth; x++) {
var red = x * y & 0xff,
green = x & 0xff,
blue = y & 0xff,
alpha = 255;
r.push(red);
g.push(green);
b.push(blue);
a.push(alpha);
b32.push((alpha << 24) | (blue << 16) | (green << 8) | red);
v32.push((red << 24) | (green << 16) | (blue << 8) | alpha);
}
}
var mr = r[0],
mg = g[0],
mb = b[0],
ma = a[0],
mb32 = b32[0],
mv32 = v32[0];
```

Ready to run.

Test | Ops/sec | |
---|---|---|

putImageData Ref |
| ready |

putImageData Direct |
| ready |

putImageData Temp |
| ready |

32-bit Set |
| ready |

32-bit Direct |
| ready |

32-bit Uint |
| ready |

32-bit DataView |
| ready |

putImageData Ref Mono |
| ready |

putImageData Direct Mono |
| ready |

putImageData Temp Mono |
| ready |

32-bit Set Mono |
| ready |

32-bit Direct Mono |
| ready |

32-bit Uint Mono |
| ready |

32-bit DataView Mono |
| ready |

You can edit these tests or add more tests to this page by appending /edit to the URL.

- Revision 1: published by Andrew J. Baker on
- Revision 3: published on
- Revision 4: published on
- Revision 5: published by PlayMyCode on
- Revision 6: published by Andrew J. Baker on
- Revision 7: published on
- Revision 8: published by PlayMyCode on
- Revision 9: published by PlayMyCode on
- Revision 10: published by PlayMyCode on
- Revision 11: published on
- Revision 18: published on
- Revision 19: published by Arkanciscan on
- Revision 23: published on
- Revision 24: published on
- Revision 27: published by imaya on
- Revision 28: published on
- Revision 29: published by ard on
- Revision 30: published on
- Revision 34: published on
- Revision 35: published on
- Revision 37: published by PAEz on
- Revision 41: published on
- Revision 42: published on
- Revision 43: published on
- Revision 44: published on
- Revision 47: published by Autarc on
- Revision 48: published on
- Revision 49: published by Dan H on
- Revision 50: published on
- Revision 53: published by Russell Chapman on
- Revision 54: published on
- Revision 56: published by HotSix on
- Revision 57: published by Andymensional on
- Revision 62: published on
- Revision 63: published on
- Revision 64: published on
- Revision 65: published on
- Revision 66: published on
- Revision 67: published on
- Revision 68: published on
- Revision 69: published on
- Revision 72: published by orwellophile on
- Revision 75: published on
- Revision 76: published by Ghetolay on
- Revision 78: published on
- Revision 79: published on
- Revision 80: published on
- Revision 81: published on
- Revision 82: published on
- Revision 83: published on
- Revision 84: published on
- Revision 85: published on
- Revision 86: published by mattdesl on
- Revision 87: published by mattdesl on
- Revision 88: published by mattdesl on
- Revision 90: published by mattdesl on
- Revision 91: published on
- Revision 92: published on
- Revision 93: published on
- Revision 95: published on
- Revision 96: published on
- Revision 97: published on
- Revision 98: published on
- Revision 99: published on
- Revision 100: published on
- Revision 101: published on
- Revision 102: published on
- Revision 103: published on
- Revision 104: published on
- Revision 106: published on
- Revision 107: published on
- Revision 109: published on
- Revision 110: published on
- Revision 111: published on
- Revision 112: published on
- Revision 113: published on
- Revision 116: published by ass on
- Revision 117: published by ass on
- Revision 118: published by ass on
- Revision 123: published on
- Revision 124: published on
- Revision 125: published by Al on
- Revision 128: published by ап on
- Revision 129: published by ап on
- Revision 131: published by ziomio on
- Revision 132: published on
- Revision 136: published by CircleGuy on
- Revision 137: published on
- Revision 138: published on
- Revision 139: published on
- Revision 140: published by cast to uint8 on
- Revision 141: published on
- Revision 142: published on
- Revision 144: published by Carter on
- Revision 148: published on
- Revision 149: published on
- Revision 150: published by Nam on
- Revision 151: published on
- Revision 160: published on
- Revision 161: published by pierre lepers on
- Revision 162: published by pierre lepers on
- Revision 163: published by pierre lepers on
- Revision 164: published on
- Revision 165: published on
- Revision 166: published on
- Revision 167: published by Chadnaut on
- Revision 168: published by Chadnaut on
- Revision 171: published by julian libor on