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
Comparing native, bubble, insertion, selection, merge, adaptive merge, and quick sort algorithms on a random array.
<script src="https://rawgithub.com/escherba/algorithms-in-javascript/master/src/common.js">
</script>
<script src="https://rawgithub.com/escherba/algorithms-in-javascript/master/src/bubble-sort.js">
</script>
<script src="https://rawgithub.com/escherba/algorithms-in-javascript/master/src/insertion-sort.js">
</script>
<script src="https://rawgithub.com/escherba/algorithms-in-javascript/master/src/merge-sort.js">
</script>
<script src="https://rawgithub.com/escherba/algorithms-in-javascript/master/src/adaptive-sort.js">
</script>
<script src="https://rawgithub.com/escherba/algorithms-in-javascript/master/src/quickmiddle-sort.js">
</script>
<script src="https://rawgithub.com/escherba/algorithms-in-javascript/master/src/selection-sort.js">
</script>
<script src="https://rawgithub.com/escherba/algorithms-in-javascript/master/src/flashsort.js">
</script>
<script src="https://rawgithub.com/escherba/algorithms-in-javascript/master/src/heap-sort.js">
</script>
// Generate array with 1 million random integers.
testArrayLength = 100;
var unsortedTestArray = new Array(testArrayLength);
for (var i = 0; i < testArrayLength; i++) {
unsortedTestArray[i] = Math.floor(Math.random()*1000000);
}
var sortedTestArray = unsortedTestArray.clone().sort(function compareNumbers(a, b) {
return a - b;
});
if (!unsortedTestArray.compare(sortedTestArray)) {
throw new Error("Array was not sorted");
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Native |
| ready |
InsertionSort |
| ready |
Heapsort |
| ready |
AdaptiveSort |
| ready |
MergeSort |
| ready |
QuickSort |
| ready |
Flashsort |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.