Test name | Executions per second |
---|---|
var child = JSON.parse(JSON.stringify(parent)); | 83084.1 Ops/sec |
child[i] = parent[i].slice()/// var child = []; for (var i = 0; i < parent.length; i += 1) { child[i] = parent[i].slice(); } | 259284.0 Ops/sec |
child[i][j] = parent[i][j]/// var child = []; for (var i = 0; i < parent.length; i += 1) { child[i] = []; for (var j = 0; j < parent[i].length; j += 1) { child[i][j] = parent[i][j]; } } | 36221.5 Ops/sec |
var child = JSON.parse(JSON.stringify(sparent)); | 192875.2 Ops/sec |
var child = sparent.slice(); | 5788186.0 Ops/sec |
child[i] = sparent[i]/// var child = []; for (var i = 0; i < parent.length; i += 1) { child[i] = sparent[i]; } | 287421.4 Ops/sec |