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 udacity optimise course
<div id="movingPizzas1">
</div>
<script>
function createBGPizza() {
var cols = 8;
var s = 256;
for (var i = 0; i < 50; i++) { // Generating pizzas based on screen size instead of a default 200.
var elem = document.createElement('img');
elem.className = 'mover'
elem.src = "http://ro-savage.github.io/udacity-optimise/views/images/pizza.png"; // Stop the browser from resizing image
elem.style.height = "100px";
elem.style.width = "73.333px";
elem.style.position = "fixed";
elem.style.transform = "translate3d(0, 0, 0)";
//elem.style.webkitBackfaceVisibility = "hidden";
//elem.style.webkitPerspective = "1000";
elem.style.backfaceVisibility = "hidden";
elem.style.perspective = "1000";
elem.phase = i % 5; // Added a phase number here when it was created to be looked up later
elem.basicLeft = (i % cols) * s; // Replaced with above, simplify the formula in movement loop.
elem.style.top = (Math.floor(i / cols) * s) + 'px';
document.querySelector("#movingPizzas1").appendChild(elem);
}
};
createBGPizza();
</script>
var randomScrollTop = Math.random() * 10000;
Ready to run.
Test | Ops/sec | |
---|---|---|
Original code |
| ready |
Calculate phase in loop |
| ready |
Calculate phase outside loop and query object |
| ready |
Original using transform |
| ready |
Original using transform without basicLeft lookup |
| ready |
Calculate Phase in loop - basic left |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.