Comparing performance of: Object.assign vs spread operator

JavaScript performance comparison

Revision 3 of this test case created by Riccardo Polacci

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Object.assign
var params = {
    "_id": "5c49a3f586a314e1da9bc5c4",
    "index": 0,
    "guid": "4a19223f-e806-4590-b0b2-bc52854010e9",
    "isActive": true,
    "balance": "$1,341.65",
    "picture": "http://placehold.it/32x32",
    "age": 33,
    "eyeColor": "brown",
    "name": "English Peck",
    "gender": "male",
    "company": "APPLIDECK",
    "email": "englishpeck@applideck.com",
    "phone": "+1 (995) 574-3187",
    "address": "479 Lloyd Court, Cecilia, District Of Columbia, 4378",
    "about": "Sunt laborum commodo ex nisi. Sint amet sit excepteur qui do veniam qui sint sit labore id. Laboris laborum amet eiusmod laborum duis.\r\n",
    "registered": "2017-02-11T03:09:56 -01:00",
    "latitude": 31.939115,
    "longitude": -54.305863,
    "tags": [
      "laborum",
      "laboris",
      "cupidatat",
      "nostrud",
      "dolore",
      "ex",
      "duis"
    ],
    "friends": [
      {
        "id": 0,
        "name": "Susie Sawyer"
      },
      {
        "id": 1,
        "name": "Lola Ware"
      },
      {
        "id": 2,
        "name": "Bender Barrera"
      }
    ],
    "greeting": "Hello, English Peck! You have 10 unread messages.",
    "favoriteFruit": "banana"
  };
var other = Object.assign({}, { a: 2 }, params);
pending…
spread
var params = {
    "_id": "5c49a3f586a314e1da9bc5c4",
    "index": 0,
    "guid": "4a19223f-e806-4590-b0b2-bc52854010e9",
    "isActive": true,
    "balance": "$1,341.65",
    "picture": "http://placehold.it/32x32",
    "age": 33,
    "eyeColor": "brown",
    "name": "English Peck",
    "gender": "male",
    "company": "APPLIDECK",
    "email": "englishpeck@applideck.com",
    "phone": "+1 (995) 574-3187",
    "address": "479 Lloyd Court, Cecilia, District Of Columbia, 4378",
    "about": "Sunt laborum commodo ex nisi. Sint amet sit excepteur qui do veniam qui sint sit labore id. Laboris laborum amet eiusmod laborum duis.\r\n",
    "registered": "2017-02-11T03:09:56 -01:00",
    "latitude": 31.939115,
    "longitude": -54.305863,
    "tags": [
      "laborum",
      "laboris",
      "cupidatat",
      "nostrud",
      "dolore",
      "ex",
      "duis"
    ],
    "friends": [
      {
        "id": 0,
        "name": "Susie Sawyer"
      },
      {
        "id": 1,
        "name": "Lola Ware"
      },
      {
        "id": 2,
        "name": "Bender Barrera"
      }
    ],
    "greeting": "Hello, English Peck! You have 10 unread messages.",
    "favoriteFruit": "banana"
  };
var other = { a: 2, ...params };
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL.

0 Comments