HTML Preparation code:
AخA
 
1
<div id='min-data'></div>
Tests:
  • with reduce()

    x
     
    const div = document.getElementById('min-data');
    const newArray = [];
    for(let i = 0; i < 10; i++){
        const num = Math.floor(Math.random() * 10);
        newArray.push(num);
    } 
    newArray.reduce((a, b) => (a < b ? a : b), []);
    div.innerHTML = newArray[0].toString();
  • with sort()

     
    const div = document.getElementById('min-data');
    const newArray = [];
    for(let i = 0; i < 10; i++){
        const num = Math.floor(Math.random() * 10);
        newArray.push(num);
    } 
    newArray.sort((a, b) => a - b);
    div.innerHTML = newArray[0].toString();
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    with reduce()
    with sort()

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 9 months ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Chrome 126 on Linux
View result in a separate tab
Test name Executions per second
with reduce() 371129.1 Ops/sec
with sort() 390799.7 Ops/sec