HTML Preparation code:
AخA
 
1
<script src="https://cdnjs.cloudflare.com/ajax/libs/ramda/0.25.0/ramda.min.js"></script>
2
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js"></script>
3
<script src="https://cdn.rawgit.com/ivolovikov/fastest-clone/master/index.js"></script>
4
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/2.1.4/benchmark.min.js"></script>
Script Preparation code:
 
// intial data
var source = {a:1,b:1,c:1,d:1,e:1,f:1,g:1,h:{a:-1,b:1,c:1,d:1,e:1,f:1,g:1}};
Tests:
  • Lodash

     
    var result = _.cloneDeep(source);
      
      // adding checking to prevent compiler optimization
      if (result.h.a != -1) throw new Error('Object not clonned');
      result.h.a = Math.random();
  • Ramda without relying on currying or composition

     
    var result = R.clone(source);
      
      // adding checking to prevent compiler optimization
       if (result.h.a != -1) throw new Error('Object not clonned');
       result.h.a = Math.random();
  • Fast Clone

    x
     
    var CloneFactory = FastClone.factory(source);
    var result = new CloneFactory(source);
    // adding checking to prevent compiler optimization
      if (result.h.a != -1) throw new Error('Object not clonned');
      result.h.a = Math.random();
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Lodash
    Ramda without relying on currying or composition
    Fast Clone

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 6 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
Chrome 68 on Mac OS X 10.11.6
View result in a separate tab
Test name Executions per second
Lodash 191458.0 Ops/sec
Ramda without relying on currying or composition 334130.5 Ops/sec
Fast Clone 53560.3 Ops/sec