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
mysort = function (arr) {
for (var i = 0 ; i < arr.length ; i++) {
var n = arr[i];
for (var j = i+1 ; j < arr.length ; j++) {
if (arr[j] < n) {
arr[i] = arr[j];
arr[j] = n;
n = arr[i];
j = i + 1;
}
}
}
return arr;
}
function sortBubble(data) {
var tmp;
for (var i = data.length - 1; i > 0; i--) {
for (var j = 0; j < i; j++) {
if (data[j] > data[j+1]) {
tmp = data[j];
data[j] = data[j+1];
data[j+1] = tmp;
}
}
}
return data;
}
Ready to run.
Test | Ops/sec | |
---|---|---|
native sort |
| ready |
my sort |
| ready |
bubble sort |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.