Hasty
.dev
Performance. Unbound.
New Benchmark
•
New Notebook
•
Shorts
Hasty
.dev
New Benchmark
•
New Notebook
•
Shorts
Shared Benchmark
Globals
const data = [ ...new Array(3500) ].map(Math.random)
Cases
Add case
0 ops/s
function heapSort(arr) { const len = arr.length; let end = len - 1; heapify(arr, len); while (end > 0) { swap(arr, end--, 0); siftDown(arr, 0, end); } return arr; } function heapify(arr, len) { let mid = Math.floor((len - 2) / 2); while (mid >= 0) { siftDown(arr, mid--, len - 1); } } function siftDown(arr, start, end) { let root = start; let child = root * 2 + 1; let toSwap = root; while (child <= end) { if (arr[toSwap] < arr[child]) { swap(arr, toSwap, child); } if (child + 1 <= end && arr[toSwap] < arr[child + 1]) { swap(arr, toSwap, child + 1); } if (toSwap != root) { swap(arr, root, toSwap); root = toSwap; } else { return; } toSwap = root; child = root * 2 + 1; } } function swap(arr, i, j) { const temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } heapSort(data);
0 ops/s
function selectionSort(arr) { const len = arr.length; let minIdx; let temp; for (let i = 0; i < len; i++) { minIdx = i; for (let j = i + 1; j < len; j++) { if (arr[j] < arr[minIdx]) { minIdx = j; } } temp = arr[i]; arr[i] = arr[minIdx]; arr[minIdx] = temp; } return arr; } selectionSort(data);
Epochs:
Timeout:
Embed
Share
Options
Run
Shorts
Notebook Demo
Blog
Donate
Wall of love 😻
Popular
Telegram
Uptime
Bluesky
New Benchmark
New Notebook
HASTY.dev
Explore HASTY, your go-to platform for reliable JS benchmark tests. Improve your JavaScript performance and coding efficiency today by optimizing it.
https://techhub.social/@Mobilpadde
https://techhub.social/@Mobilpadde/112172445238616181
https://techhub.social/@Mobilpadde/112172445238616181