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
Testing 'reasonable' methods to set one pixel on an HTML5 Canvas; used to support this Stack Overflow question.
<p>(Scroll down to see the 'Run Tests' button.)</p>
<canvas id="c" width="800" height="300"></canvas>
<script>
$c = document.getElementById('c');
$ctx = $c.getContext('2d');
$ctx.clearRect(0, 0, 800, 300);
$px = $ctx.createImageData(1, 1);
$pxls = [];
// Precompute random pixels so this time isn't included in the tests
for (var i = 0; i < 10000; ++i) $pxls.push({
x: Math.random() * 800 << 0,
y: Math.random() * 300 << 0,
r: Math.random() * 255 << 0,
g: Math.random() * 255 << 0,
b: Math.random() * 255 << 0,
a: Math.random() * 128 << 0 + 128
});
$i = 0;
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
get/putImageData |
| ready |
fillRect |
| ready |
1x1 image data |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.