Script Preparation code:
x
 
var a=Array.from({length:100},()=>Math.random())
function insertionSort(arr){
    //Start from the second element.
    for(let i = 1; i < arr.length;i++){
        //Go through the elements behind it.
        for(let j = i - 1; j > -1; j--){
            
            //value comparison using ascending order.
            if(arr[j + 1] < arr[j]){
                //swap
                [arr[j+1],arr[j]] = [arr[j],arr[j + 1]];
            }
        }
    };
  return arr;
}
function selectionSort(arr) {
  let min;
  //start passes.
  for (let i = 0; i < arr.length; i++) {
    //index of the smallest element to be the ith element.
    min = i;
    //Check through the rest of the array for a lesser element
    for (let j = i + 1; j < arr.length; j++) {
      if (arr[j] < arr[min]) {
        min = j;
      }
    }
    //compare the indexes
    if (min !== i) {
      //swap
      [arr[i], arr[min]] = [arr[min], arr[i]];
    }
  }
  return arr;
}
Tests:
  • sort

     
    var b = a.slice();
    b.sort();
  • insertion sort

     
    var b = a.slice();
    insertionSort(b)
  • select sort

     
    var b = a.slice();
    selectionSort(b)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    sort
    insertion sort
    select sort

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0
Firefox 91 on Linux
View result in a separate tab
Test name Executions per second
sort 23000.0 Ops/sec
insertion sort 3864.2 Ops/sec
select sort 22060.8 Ops/sec