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
Compares the performance of HTML5 canvas drawing functions in case integer coordinates are given and in case coordinates are offset by .5 pixel; third test compares the performance in case integer coordinates are used, but the canvas transformation matrix is offset by .5 pixels. Test consists of sequential rendering of 100 1px wide vertical lines at 5px intervals.
<canvas id="canvas" width="512" height="224"></canvas>
<script>
var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
ctx.strokeStyle = '#000';
ctx.lineWidth = 1;
ui.benchmarks[2].setup = function() {
ctx.setTransform(1, 0, 0, 1, 0.5, 0.5);
};
ui.benchmarks[0].teardown =
ui.benchmarks[1].teardown = function() {
ctx.clearRect(0, 0, 512, 224);
};
ui.benchmarks[2].teardown = function() {
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.clearRect(0, 0, 512, 224);
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Integer X |
| ready |
X + .5 |
| ready |
Integer X on a transformed canvas |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.