Tests:
  • Test5

    x
     
    const testArray = [
    [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], 
    [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
    [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45]]
    var newTestArray = new Array();
        for (var x = 0; x < testArray.length; x++){
            for (var y = 0; y < testArray[x].length; y++){
                newTestArray.push(testArray[x][y])
            }
        }
  • Test4

     
    const testArray = [
    [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], 
    [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
    [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45]]
    const newTestArray = testArray.reduce((prev, next) => prev.concat(next))
  • Test3

     
    const testArray = [
    [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], 
    [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
    [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45]]
    const newTestArray = [].concat(...testArray)
  • Test2

     
    const testArray = [
    [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], 
    [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
    [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45]]
    const newTestArray = testArray.join().split(",");
  • Test1

     
    const testArray = [
    [1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], 
    [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
    [31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45]]
    const newTestArray = [...new Set(testArray.flat())]
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Test5
    Test4
    Test3
    Test2
    Test1

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Chrome 116 on Windows
View result in a separate tab
Test name Executions per second
Test5 1115581.1 Ops/sec
Test4 1336402.1 Ops/sec
Test3 1999008.6 Ops/sec
Test2 132124.7 Ops/sec
Test1 52164.6 Ops/sec