Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0
Firefox 85
Windows
Desktop
4 years ago
Test name Executions per second
JSON.parse 237591.3 Ops/sec
Object.assign 1463821.0 Ops/sec
Script Preparation code:
AخA
 
var obj = {a: "hello", c: "test", po: 33, arr: [1, 2, 3, 4], anotherObj: {a: 33, str: "whazzup"}};
Tests:
  • JSON.parse

     
    var obj2 = JSON.parse(JSON.stringify(obj));
  • Object.assign

     
    var obj2 = Object.assign({}, obj);