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
see comment
// cache them as globals!
var str = 'Some string',
num = 5 * 34,
arr = [1,2,3,4],
job = function () {
// do something;
};
var initials = {
str: str,
num: num,
arr: arr,
job: job
};
function bottleneck1 () {
var str = 'Some string',
num = 5 * 34,
arr = [1,2,3,4],
job = function () {
// do something;
};
job(str, num, arr);
}
function bottleneck1b() {
var str = initials.str,
num = initials.num,
arr = initials.arr.slice(),
job = initials.job;
job(str,num,arr);
}
function bottleneck2 () {
var arr = [1,2,3,4],
num = 5 * 34,
job = function () {
// do something;
};
job(str, num, arr);
}
function bottleneck3 () {
var str = 'Some string',
num = 5 * 34,
job = function () {
// do something;
};
job(str, num, arr);
}
function bottleneck4 () {
var str = 'Some string',
arr = [1,2,3,4],
job = function () {
// do something;
};
job(str, num, arr);
}
function bottleneck5 () {
var str = 'Some string',
arr = [1,2,3,4],
num = 5 * 34;
job(str, num, arr);
}
function bottleneck6 () {
job(str, num, arr);
}
Ready to run.
Test | Ops/sec | |
---|---|---|
no cache |
| ready |
cache string |
| ready |
cache number |
| ready |
cache array |
| ready |
cache function |
| ready |
cache everything |
| ready |
Test 1b |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.