Script Preparation code:
AخA
 
options = [
  {
    description: "Pack Toit Ouvrant Panoramique Electrique",
    group_name: "exterieur",
    id_equipement: 98327,
    option_flag: 1,
    pack_content: [98319, 98216],
    pack_flag: 1,
    prix_ttc: 1400,
    _id: "5bae447a09a33a0342646f9b"
  },
  {
    description: "Rouge Ultimate",
    group_name: "exterieur",
    id_equipement: 98301,
    option_flag: 1,
    pack_content: [],
    pack_flag: 0,
    prix_ttc: 830,
    _id: "5bae41b209a33a0342646e5e"
  },
  {
    description: "Roue galette",
    group_name: "securite",
    id_equipement: 98265,
    option_flag: 1,
    pack_content: [],
    pack_flag: 0,
    prix_ttc: 100,
    _id: "5bae446b09a33a0342646f98"
  },
  {
    description: "Pack Toit Ouvrant Panoramique Electrique",
    group_name: "exterieur",
    id_equipement: 98327,
    option_flag: 1,
    pack_content: [98319, 98216],
    pack_flag: 1,
    prix_ttc: 1400,
    _id: "5bae447a09a33a0342646f9b"
  },
  {
    description: "Rouge Ultimate",
    group_name: "exterieur",
    id_equipement: 98301,
    option_flag: 1,
    pack_content: [],
    pack_flag: 0,
    prix_ttc: 830,
    _id: "5bae41b209a33a0342646e5e"
  },
  {
    description: "Roue galette",
    group_name: "securite",
    id_equipement: 98265,
    option_flag: 1,
    pack_content: [],
    pack_flag: 0,
    prix_ttc: 100,
    _id: "5bae446b09a33a0342646f98"
  },
  {
    description: "Pack Toit Ouvrant Panoramique Electrique",
    group_name: "exterieur",
    id_equipement: 98327,
    option_flag: 1,
    pack_content: [98319, 98216],
    pack_flag: 1,
    prix_ttc: 1400,
    _id: "5bae447a09a33a0342646f9b"
  },
  {
    description: "Rouge Ultimate",
    group_name: "exterieur",
    id_equipement: 98301,
    option_flag: 1,
    pack_content: [],
    pack_flag: 0,
    prix_ttc: 830,
    _id: "5bae41b209a33a0342646e5e"
  },
  {
    description: "Roue galette",
    group_name: "securite",
    id_equipement: 98265,
    option_flag: 1,
    pack_content: [],
    pack_flag: 0,
    prix_ttc: 100,
    _id: "5bae446b09a33a0342646f98"
  }
 ];
Tests:
  • 1

     
    const final = options.map(ele => ele.description).filter((ele, i, arr) => arr.indexOf(ele) === i);
  • 2

     
    const final = options.reduce((acc, cur) => acc.some(x=> (x.description === cur.description)) ? acc : acc.concat(cur), []);
  • 3

     
    const toObj = {};
    options.forEach((o) => toObj[o.description] = o);
    const final = Object.values(toObj);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    1
    2
    3

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 6 years ago)
Mozilla/5.0 (X11; Fedora; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36
Chrome 73 on Fedora
View result in a separate tab
Test name Executions per second
1 2967501.0 Ops/sec
2 775440.7 Ops/sec
3 1181437.4 Ops/sec