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
Showing the performance differences between locally scoped functions.
var foodsArr = ['pizza', 'banana', 'pie', 'steak', 'fries', 'soup', 'tuna', 'rice', 'greek salad', 'bagels'];
function consumeFoods1(foods) {
for (var i = 0, len = foods.length; i < len; i++) {
eat(foods[i]);
}
}
function consumeFoods2(foods) {
var eatFunc = eat;
for (var i = 0, len = foods.length; i < len; i++) {
eatFunc(foods[i]);
}
}
function eat(food) {
console.log('You just ate: '+food+'');
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Not locally scoped |
| ready |
Locally scoped |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.