object.create vs _.clone
Date tested:
6 years ago
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Test name
Executions per second
_.clone
885199.4 Ops/sec
object.create
2608225.5 Ops/sec
Benchmark definition (click to collapse):
HTML Preparation code:
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lodash@4.17.10/lodash.min.js"></script>
Script Preparation code:
var items = { a: { b: 'b', c: { d: 'd', }, }, b: { b: 'b', c: { d: 'd', }, }, c: { b: 'b', c: { d: 'd', }, }, d: { b: 'b', c: { d: 'd', }, }, e: { b: 'b', c: { d: 'd', }, }, }
Tests:
_.clone
var cope = _.clone(items);
object.create
var cope = Object.create(items);
Open this result on MeasureThat.net