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
Test speed of a loop versus sequence of calls.
<script>
function foo() {
var x = Math.random() * Math.random();
return x
}
// 100 iterations of 10 iterations of 1 call
function loops() {
var i = 100;
var j = 10;
var n;
while (i--) {
n = j;
while (n--) {
foo();
}
}
}
// 100 iterations of 10 calls
function calls() {
var i = 100;
while (i--) {
foo();
foo();
foo();
foo();
foo();
foo();
foo();
foo();
foo();
foo();
}
}
// 200 iterations of 5 calls
function calls2() {
var i = 200;
while (i--) {
foo();
foo();
foo();
foo();
foo();
}
}
// 1,000 iterations of 1 call
function justIterations() {
var i = 1000;
while (i--) foo();
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Loops |
| ready |
Calls |
| ready |
justIterations |
| ready |
calls2 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.