HTML Preparation code:
AخA
 
1
<script>
2
    window.exports = {};
3
</script>
4
<!-- Don't use fastest-json-copy like this. Instead, import it and use webpack. -->
5
<script src="https://cdn.jsdelivr.net/npm/fastest-json-copy@1.0.1/lib/v1.js"></script>
6
<script>
7
    window.fastestJsonCopy = window.exports.copy;
8
</script>
Script Preparation code:
x
 
var MyObject = {
    a: 1,
    b: 'ddddddddddddddddd',
    c: 'sssssssssssssssssssssssssssssssssssssssssssssssssss',
    d: [1, 2, 3, 4, 5, 6, 7, 8, 9],
};
var myCopy = null;
Tests:
  • JSON.parse(JSON.stringify())

     
    myCopy = JSON.parse(JSON.stringify(MyObject));
  • fastest-json-copy npm package

     
    myCopy = fastestJsonCopy(MyObject);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    JSON.parse(JSON.stringify())
    fastest-json-copy npm package

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0
Firefox 89 on Windows
View result in a separate tab
Test name Executions per second
JSON.parse(JSON.stringify()) 173871.7 Ops/sec
fastest-json-copy npm package 183229.0 Ops/sec