Script Preparation code:
AخA
 
var obj = [
        {
          type: "fixedCost",
          description: {
            content: "<p><br></p>",
            widgets: {},
            tokens: [
              {
                type: "block",
                subType: "paragraph",
              },
              {
                type: "inline",
                subType: "text",
                content: "TMS and ESS Licences",
                style: {},
              },
            ],
          },
          quantity: 1,
          discount: {
            enabled: false,
            type: "percent",
            units: 0,
          },
          rate: {
            unit: "Employee Licence",
            rate: 4.05,
          },
          isTaxExempt: false,
          interactive: {
            isOptional: false,
            isOptionalSelected: false,
            isQuantityOptional: false,
            quantityRange: {
              min: 0,
              max: 0,
            },
            isOptionalQuantity: false,
          },
          currency: "GBP",
          id: "k55w3lGzGM4",
        },
        {
          type: "fixedCost",
          description: {
            content: "<p><br></p>",
            widgets: {},
            tokens: [
              {
                type: "block",
                subType: "paragraph",
              },
              {
                type: "inline",
                subType: "text",
                content: "Biometric Clock",
              },
            ],
          },
          quantity: 5,
          discount: {
            enabled: false,
            type: "percent",
            units: 0,
          },
          rate: {
            unit: "Unit",
            rate: 1500,
          },
          isTaxExempt: false,
          interactive: {
            isOptional: true,
            isOptionalSelected: false,
            isQuantityOptional: true,
            quantityRange: {
              min: 0,
              max: 5,
            },
          },
          currency: "GBP",
          id: "iQWwrO6qLew",
        },
        {
          type: "fixedCost",
          description: {
            content: "<p><br></p>",
            widgets: {},
            tokens: [
              {
                subType: "paragraph",
                type: "block",
              },
              {
                content: "Proximity Clock",
                subType: "text",
                type: "inline",
              },
            ],
          },
          quantity: 5,
          discount: {
            enabled: false,
            type: "percent",
            units: 0,
          },
          rate: {
            unit: "Unit",
            rate: 1500,
          },
          isTaxExempt: false,
          interactive: {
            isOptional: true,
            isOptionalSelected: false,
            isQuantityOptional: true,
            quantityRange: {
              min: 0,
              max: 100,
            },
          },
          currency: "GBP",
          id: "u0eMdVcAx1U",
        },
        {
          type: "text",
          description: {
            content: "<p><br></p>",
            widgets: {},
            tokens: [
              {
                type: "block",
                subType: "paragraph",
              },
              {
                type: "inline",
                subType: "text",
                content: "T&amp;A Clocking Terminals",
                style: {},
              },
            ],
          },
          interactive: {
            isOptional: false,
            isOptionalSelected: false,
          },
          id: "dPVSGJMm97g",
        },
        {
          type: "fixedCost",
          description: {
            content: "<p><br></p>",
            widgets: {},
            tokens: [
              {
                type: "block",
                subType: "paragraph",
              },
              {
                type: "inline",
                subType: "text",
                content:
                  "MF900 Stainless Steel T&amp;A/Muster Point (UK Only) (Reader Required - To be Identified from External Readers)",
                style: {},
              },
            ],
          },
          quantity: 1,
          discount: {
            enabled: false,
            type: "percent",
            units: 0,
          },
          rate: {
            unit: "Unit",
            rate: 1750,
          },
          isTaxExempt: false,
          interactive: {
            isOptional: false,
            isOptionalSelected: false,
            isQuantityOptional: false,
            quantityRange: {
              min: 0,
              max: 0,
            },
            isOptionalQuantity: false,
          },
          currency: "GBP",
          id: "BCLCCimoZ6M",
        },
        {
          type: "fixedCost",
          description: {
            content: "<p><br></p>",
            widgets: {},
            tokens: [
              {
                type: "block",
                subType: "paragraph",
              },
              {
                type: "inline",
                subType: "text",
                content:
                  "MF901 Stainless Steel T&amp;A/Muster Point - PoE - (Beta Test Sites Only) (Reader Required - To be Identified from External Readers)",
                style: {},
              },
            ],
          },
          quantity: 1,
          discount: {
            enabled: false,
            type: "percent",
            units: 0,
          },
          rate: {
            unit: "Unit",
            rate: 1750,
          },
          isTaxExempt: false,
          interactive: {
            isOptional: false,
            isOptionalSelected: false,
            isQuantityOptional: false,
            quantityRange: {
              min: 0,
              max: 0,
            },
            isOptionalQuantity: false,
          },
          currency: "GBP",
          id: "AOqDHpIIeAI",
        },
      ];
Tests:
  • spread

     
    let newObj = [...obj]
  • for loop

     
    let newObj = []
    for(let i=0; i<obj.length; i++) {
      newObj[i] = obj[i]
    }
  • for loop (array push)

     
    let newObj = []
    for(let i=0; i<obj.length; i++) {
      newObj.push(obj[i])
    }
  • slice

     
    let newArr = obj.slice();
  • Array.from

     
    let newArr = Array.from(obj);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    spread
    for loop
    for loop (array push)
    slice
    Array.from

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 27 days ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Chrome 137 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
spread 75426696.0 Ops/sec
for loop 42432000.0 Ops/sec
for loop (array push) 24484922.0 Ops/sec
slice 102587952.0 Ops/sec
Array.from 71337888.0 Ops/sec