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
<script>
var findLocationFor = function(n, arr) {
var i = Math.floor(arr.length / 2);
var prev_i = arr.length;
while (1) {
var b = i;
if (arr[i] === n) return i + 1;
if (arr[i] < n) {
if (i === arr.length - 1 || arr[i + 1] > n) {
return i + 1;
}
i += Math.floor(Math.abs(prev_i - i) / 2);
} else // arr[i] > n
{
if (i === 0 || arr[i - 1] < n) {
return i + 1;
}
i -= Math.floor(Math.abs(prev_i - i) / 2);
}
prev_i = b;
}
}
</script>
var largeArray = [];
for (var n = 0; n < 10000; n++) {
largeArray.push(n);
}
var newVal = 1337.5;
delete largeArray;
Ready to run.
Test | Ops/sec | |
---|---|---|
push() and sort() |
| ready |
splice() |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.