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 myList = [1, 3, 6, 10, 14, 15, 18, 20, 25, 33, 36, 40, 43, 44, 48, 50];
function binary_search_iterative2(arr, ele) {
var beginning = 0, end = arr.length,
target, v;
while (true) {
target = ((beginning + end) >> 1);
if ((target === end || target === beginning) && arr[target] !== ele) {
return -1;
}
v = arr[target];
if (v > ele) {
end = target;
} else if (v < ele) {
beginning = target;
} else {
return target;
}
}
}
function binary_search_iterative(arr, ele) {
var beginning = 0, end = arr.length,
target, v;
while (true) {
target = Math.floor((beginning + end) / 2);
if ((target === end || target === beginning) && arr[target] !== ele) {
return -1;
}
v = arr[target];
if (v > ele) {
end = target;
} else if (v < ele) {
beginning = target;
} else {
return target;
}
}
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
new |
| ready |
original |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.