Script Preparation code:
AخA
 
var array = Array.from({ length: 10000 }, () => Math.floor(Math.random() * 10000))
Tests:
  • sort

    x
     
    array.forEach(n => {
      const repeat = Math.sqrt(n);
      const result = [[], []];
      for (let i = 1; i <= repeat; i++) { 
              if(n % i === 0) {
                  result.push(i);
                  if (i !== repeat) result.push(n / i);
              }
      }
      result.sort((a, b) => a - b)
      }
    )
  • reverse

     
    array.forEach(n => {
      const repeat = Math.sqrt(n);
      const result = [[], []];
      for (let i = 1; i < repeat; i++) { 
              if(n % i === 0) {
                  result[0].push(i);
                  result[1].push(n / i);
              }
      }
      if (Number.isInteger(repeat)) result[0].push(repeat)
      result[1].reverse();
      result.flat()
      }
    )
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    sort
    reverse

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36
Chrome 130 on Windows
View result in a separate tab
Test name Executions per second
sort 38.9 Ops/sec
reverse 73.0 Ops/sec