Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
structuredClone vs _.cloneDeep vs JSON vs rfdc
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0
Browser:
Firefox 128
Operating system:
Linux
Device Platform:
Desktop
Date tested:
9 months ago
Test name
Executions per second
JSON
5.1 Ops/sec
Lodash
1.5 Ops/sec
rfdc
7.9 Ops/sec
Native
2.8 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here--> <script> window.module = {}; </script> <script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js'></script> <script src='https://unpkg.com/rfdc@1.4.1/index.js'></script> <script> window.rfdc = module.exports; </script>
Script Preparation code:
var clone = rfdc() function generateDeterministicTree(depth = 8, breadth = 6) { function createLevel(level) { if (level >= depth) { // На листьях — детерминированное значение (например, строка с номером) return `leaf_${level}`; } if (level % 2 === 0) { // Чётный — объект const obj = {}; for (let i = 0; i < breadth; i++) { obj[`key_${level}_${i}`] = createLevel(level + 1); } return obj; } else { // Нечётный — массив const arr = []; for (let i = 0; i < breadth; i++) { arr.push(createLevel(level + 1)); } return arr; } } return createLevel(0); } // Пример использования: var data = generateDeterministicTree(8, 6);
Tests:
JSON
JSON.parse(JSON.stringify(data))
Lodash
_.cloneDeep(data)
rfdc
clone(data)
Native
structuredClone(data)