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 drawing sprites, how does fillRect() with a CanvasPattern compare to drawImage? How does it differ for sub-pixel spaced images?
<canvas id="screen" width="48" height="48"></canvas>
<canvas id="imgCached" width="48" height="48" style="display:none;"></canvas>
<script>
var ctx = document.getElementById("screen").getContext("2d");
var imgCached = document.getElementById("imgCached");
var patternRepeat, patternNoRepeat;
var image = document.createElement("img");
image.onload = function() {
patternNoRepeat = ctx.createPattern(image, "no-repeat");
patternRepeat = ctx.createPattern(image, "repeat");
imgCached.getContext("2d").drawImage(image, 0, 0);
};
image.src = "http://icons.iconarchive.com/icons/ph03nyx/super-mario/48/Retro-Mushroom-1UP-2-icon.png";
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Image |
| ready |
Image shifted |
| ready |
Image subpixel 1 |
| ready |
boosted |
| ready |
Image subpixel 2 |
| ready |
boosted2 |
| ready |
boosted3 |
| ready |
boosted4 |
| ready |
boosted5 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.