Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Clone Deep vs JSON Parse Benchmark
(version: 0)
Comparing performance of:
Lodash cloneDeep vs Json parse clone
Created:
6 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js" integrity="sha256-VeNaFBVDhoX3H+gJ37DpT/nTuZTdjYro9yBruHjVmoQ=" crossorigin="anonymous"></script>
Script Preparation code:
var project = { type: 'agile', private: false, created_by: '5ae826d3b5276311899a5f77', organization_id: '5ae834e0f5ed551198ff5f3a', topic_count: 241, name: 'Test Project', created: '2018-05-01T09:35:58.668Z', updated: '2019-12-29T14:55:59.304Z', archived: false, users: [ { id: '5ae826d3b5276311899a5f77', role: 'manager', groups: [ '5ae834fe2e3d3b11b063d496' ] }, { id: '5ae826d3b5276311899a5f77', role: 'member', groups: [ '5ae834fe2e3d3b11b063d496' ] }, { id: '5d03912e2c7cc62a8b8c4a78', role: 'member', groups: [ '5ae834fe2e3d3b11b063d496' ], organization_id: '5d09d864ae1c420ba5dd7f50' }, { id: '5b3ade12071d1a11e64bdf28', role: 'manager', organization_id: '5b3c7bdda7cc1911f268bd7e', groups: [ '5ae834fe2e3d3b11b063d496' ] }, { id: '5c34dadba871bc164799d250', role: 'manager', groups: [ '5ae834fe2e3d3b11b063d496' ], organization_id: '5c34db0083466f161b252d5c' } ], groups: [ { id: '5ae834fe2e3d3b11b063d496', name: 'Default Team', is_default: true, board: { id: '5ae834fe2e3d3b11b063d497', column_order: [ -1, 0, 2, 3, 1 ], columns: [ { id: -1, name: 'Backlog', topics: [ { id: '5d81c1630ce4e11366784cc2' }, { id: '5cff47b5506d254b585c6efb' }, { id: '5cffe4d7506d254b585c6f00' }, { id: '5cffa0f2506d254b585c6efe' }, { id: '5d81c1640ce4e11366784cc6' }, { id: '5de8c0dd08d0612fe746d54c' }, { id: '5d81c1640ce4e11366784cc7' }, { id: '5d81c1640ce4e11366784cc8' }, { id: '5d81c1640ce4e11366784cc9' }, { id: '5d81c1650ce4e11366784cca' }, { id: '5d81c1650ce4e11366784ccb' }, { id: '5d81c1650ce4e11366784ccc' }, { id: '5d81c1650ce4e11366784ccd' }, { id: '5d81c1650ce4e11366784cce' }, { id: '5d81c1650ce4e11366784ccf' }, { id: '5d81c1660ce4e11366784cd1' }, { id: '5d81c1660ce4e11366784cd2' }, { id: '5d81c1660ce4e11366784cd3' }, { id: '5d81c1660ce4e11366784cd4' }, { id: '5d81c1660ce4e11366784cd5' }, { id: '5d81c1660ce4e11366784cd6' }, { id: '5d81c1670ce4e11366784cd7' }, { id: '5d81c1670ce4e11366784cd8' }, { id: '5d81c1670ce4e11366784cd9' }, { id: '5d81c1670ce4e11366784cda' }, { id: '5d81c1670ce4e11366784cdb' }, { id: '5d81c1670ce4e11366784cdc' }, { id: '5d81c1680ce4e11366784cdd' }, { id: '5d81c1680ce4e11366784cde' }, { id: '5d81c1680ce4e11366784cdf' }, { id: '5d81c1680ce4e11366784ce0' }, { id: '5d81c1680ce4e11366784ce1' }, { id: '5d81c1680ce4e11366784ce2' }, { id: '5d81c1680ce4e11366784ce3' }, { id: '5d81c1690ce4e11366784ce4' }, { id: '5d81c1690ce4e11366784ce5' }, { id: '5d81c1690ce4e11366784ce6' }, { id: '5d81c1690ce4e11366784ce7' }, { id: '5d81c1690ce4e11366784ce8' }, { id: '5d81c1690ce4e11366784ce9' }, { id: '5d81c1690ce4e11366784cea' }, { id: '5d81c1690ce4e11366784ceb' }, { id: '5d81c16a0ce4e11366784cec' }, { id: '5d81c16a0ce4e11366784ced' }, { id: '5d81c16a0ce4e11366784cee' }, { id: '5d81c16a0ce4e11366784cef' }, { id: '5d81c16a0ce4e11366784cf0' }, { id: '5d81c16a0ce4e11366784cf1' }, { id: '5d81c16a0ce4e11366784cf2' }, { id: '5d81c16b0ce4e11366784cf3' }, { id: '5d81c16b0ce4e11366784cf4' }, { id: '5d81c16b0ce4e11366784cf5' }, { id: '5d81c16b0ce4e11366784cf6' }, { id: '5d81c16b0ce4e11366784cf7' }, { id: '5d81c16b0ce4e11366784cf8' }, { id: '5d81c16b0ce4e11366784cf9' }, { id: '5d81c16c0ce4e11366784cfa' }, { id: '5d81c16c0ce4e11366784cfb' }, { id: '5d81c16c0ce4e11366784cfc' }, { id: '5d81c16c0ce4e11366784cfd' }, { id: '5d81c16c0ce4e11366784cfe' }, { id: '5d81c16c0ce4e11366784cff' }, { id: '5d81c16c0ce4e11366784d00' }, { id: '5d81c16c0ce4e11366784d01' }, { id: '5d81c16d0ce4e11366784d02' }, { id: '5d81c16d0ce4e11366784d03' }, { id: '5d81c16d0ce4e11366784d04' }, { id: '5d81c16d0ce4e11366784d05' }, { id: '5d81c16d0ce4e11366784d06' }, { id: '5d81c16d0ce4e11366784d07' }, { id: '5d81c16d0ce4e11366784d08' }, { id: '5d81c16e0ce4e11366784d09' }, { id: '5d81c16e0ce4e11366784d0a' }, { id: '5d81c16e0ce4e11366784d0b' }, { id: '5d81c16e0ce4e11366784d0c' }, { id: '5d81c16e0ce4e11366784d0d' }, { id: '5d81c16e0ce4e11366784d0e' }, { id: '5d81c16e0ce4e11366784d0f' }, { id: '5d81c16e0ce4e11366784d10' }, { id: '5d81c16f0ce4e11366784d11' }, { id: '5d81c16f0ce4e11366784d12' }, { id: '5d81c16f0ce4e11366784d13' }, { id: '5d81c16f0ce4e11366784d14' }, { id: '5d81c16f0ce4e11366784d15' }, { id: '5d81c16f0ce4e11366784d16' }, { id: '5d81c16f0ce4e11366784d17' }, { id: '5d81c1700ce4e11366784d18' }, { id: '5d81c1700ce4e11366784d19' }, { id: '5d81c1700ce4e11366784d1a' }, { id: '5d81c1700ce4e11366784d1b' }, { id: '5d81c1700ce4e11366784d1c' }, { id: '5d81c1700ce4e11366784d1d' }, { id: '5d81c1700ce4e11366784d1e' }, { id: '5d81c1710ce4e11366784d1f' }, { id: '5d81c1710ce4e11366784d20' }, { id: '5d81c1710ce4e11366784d22' }, { id: '5d81c1710ce4e11366784d23' }, { id: '5d81c1710ce4e11366784d24' }, { id: '5d81c1710ce4e11366784d25' }, { id: '5d81c1710ce4e11366784d26' }, { id: '5d81c1720ce4e11366784d27' }, { id: '5d81c1720ce4e11366784d28' }, { id: '5d81c1720ce4e11366784d29' }, { id: '5d81c1720ce4e11366784d2a' }, { id: '5d81c1720ce4e11366784d2b' }, { id: '5d81c1720ce4e11366784d2c' }, { id: '5d81c1720ce4e11366784d2d' }, { id: '5d81c1730ce4e11366784d2e' }, { id: '5d81c1730ce4e11366784d2f' }, { id: '5d81fdc10ce4e11366784d30' }, { id: '5d8203760ce4e11366784d31' }, { id: '5d8205e90ce4e11366784d32' }, { id: '5d8219070ce4e11366784d33' }, { id: '5d84add90ce4e11366784d4b' }, { id: '5d84ae630ce4e11366784d4f' }, { id: '5d84aee70ce4e11366784d52' }, { id: '5d84b0e50ce4e11366784d55' }, { id: '5d88a13303537a272a55c504' }, { id: '5d89b09203537a272a55c50a' }, { id: '5d89b09f03537a272a55c50b' }, { id: '5d89b9ba03537a272a55c50c' }, { id: '5d89db2f03537a272a55c50e' }, { id: '5d89dbad03537a272a55c50f' }, { id: '5d89dc5103537a272a55c510' }, { id: '5d89dc8c03537a272a55c511' }, { id: '5d89e41703537a272a55c512' }, { id: '5d89e86503537a272a55c513' }, { id: '5d89e88203537a272a55c514' }, { id: '5d89f4e303537a272a55c515' }, { id: '5d89f75403537a272a55c516' }, { id: '5d8a30ac03537a272a55c518' }, { id: '5d8a30ca03537a272a55c519' }, { id: '5d8cf45872bdea63bcd4f6e6' }, { id: '5d9090ce72bdea63bcd4f942' }, { id: '5d91d22472bdea63bcd4fa06' }, { id: '5d92319572bdea63bcd4fa0d' }, { id: '5d9364bff84ebf51cf150bb9' }, { id: '5d95f4c2f84ebf51cf150f1c' }, { id: '5d9b1c17aa0d5d10703c891e' }, { id: '5d9b4a86aa0d5d10703c891f' }, { id: '5d9b4d6aaa0d5d10703c8920' }, { id: '5d9b4e05aa0d5d10703c8921' }, { id: '5d9c2eebaa0d5d10703c8922' }, { id: '5d9c652eaa0d5d10703c892a' }, { id: '5d9d7a39e65daa2d12558c8d' }, { id: '5ddc176408d0612fe746d36e' }, { id: '5ddc177b08d0612fe746d36f' }, { id: '5ddcb29c08d0612fe746d379' }, { id: '5ddcb2e008d0612fe746d37a' }, { id: '5de7cad908d0612fe746d51c' }, { id: '5de7cc6608d0612fe746d51e' }, { id: '5de7cd5108d0612fe746d51f' }, { id: '5de7cde108d0612fe746d520' }, { id: '5de8a77a08d0612fe746d537' }, { id: '5de8b00a08d0612fe746d53b' }, { id: '5dea69fe08d0612fe746d5c6' }, { id: '5dea6a4108d0612fe746d5c7' }, { id: '5dea6afd08d0612fe746d5c8' }, { id: '5dea6b4e08d0612fe746d5c9' }, { id: '5dea70f408d0612fe746d5cb' }, { id: '5dea717908d0612fe746d5cc' }, { id: '5dea892908d0612fe746d5e1' }, { id: '5dea893f08d0612fe746d5e2' }, { id: '5dea89c408d0612fe746d5e3' }, { id: '5dea8c7308d0612fe746d5e4' }, { id: '5dea8cf208d0612fe746d5e5' }, { id: '5deb35c508d0612fe746d5f0' }, { id: '5deb465408d0612fe746d5fc' }, { id: '5deccb0408d0612fe746d629' }, { id: '5deccb1208d0612fe746d62a' }, { id: '5deccb2908d0612fe746d62b' }, { id: '5deccb3908d0612fe746d62c' }, { id: '5deccb6608d0612fe746d62d' }, { id: '5deccbbb08d0612fe746d62f' }, { id: '5def314808d0612fe746d6c1' }, { id: '5defa41b08d0612fe746d773' }, { id: '5defa44308d0612fe746d774' }, { id: '5defa68908d0612fe746d77c' }, { id: '5dfafeb0ad06b66a29c94f1c' }, { id: '5e01d18dad06b66a29c94f6b' }, { id: '5e0370c0ad06b66a29c94f6d' }, { id: '5e0370caad06b66a29c94f6e' }, { id: '5e047775ad06b66a29c94f7c' }, { id: '5e04b952ad06b66a29c94f85' }, { id: '5e0879f5ad06b66a29c95015' }, { id: '5e087c3ead06b66a29c9502e' }, { id: '5e089e45ad06b66a29c95039' }, { id: '5e08afaead06b66a29c950aa' } ] }, { id: -2, name: 'Archive', topics: [] }, { id: 0, name: 'In Progress', topics: [ { id: '5d42c408bb2fc54da27d77e7' }, { id: '5dea7d6e08d0612fe746d5da' }, { id: '5d89fb1303537a272a55c517' }, { id: '5dea879408d0612fe746d5df' }, { id: '5deb63ff08d0612fe746d5fd' }, { id: '5deb6e8508d0612fe746d600' }, { id: '5deb650708d0612fe746d5ff' }, { id: '5deb78fd08d0612fe746d602' }, { id: '5debd13c08d0612fe746d611' }, { id: '5debd83308d0612fe746d614' }, { id: '5debdcd208d0612fe746d616' } ] }, { id: 1, name: 'Done', topics: [ { id: '5d81c1660ce4e11366784cd0' }, { id: '5df8a297ad06b66a29c94f0c' }, { id: '5e08a706ad06b66a29c95072' }, { id: '5de8987c08d0612fe746d530' }, { id: '5e08afcbad06b66a29c950ab' }, { id: '5caf49323bf61f160406dda7' }, { id: '5deb35da08d0612fe746d5f1' }, { id: '5caf49383bf61f160406dda8' }, { id: '5debdf0408d0612fe746d625' }, { id: '5debd27f08d0612fe746d613' }, { id: '5c18ce9b8a42b343f1074b3f' }, { id: '5de7cb1a08d0612fe746d51d' }, { id: '5dea835908d0612fe746d5db' }, { id: '5dea880f08d0612fe746d5e0' }, { id: '5deb37cc08d0612fe746d5f2' }, { id: '5deb76e008d0612fe746d601' }, { id: '5debdc1a08d0612fe746d615' }, { id: '5deb791008d0612fe746d603' }, { id: '5d81c1710ce4e11366784d21' }, { id: '5def327408d0612fe746d6cb' }, { id: '5e047780ad06b66a29c94f7d' }, { id: '5e08a5d1ad06b66a29c95069' } ] }, { id: 2, name: 'New Column', topics: [ { id: '5de6801508d0612fe746d4f2' }, { id: '5d81c1630ce4e11366784cc3' }, { id: '5de7cea308d0612fe746d521' }, { id: '5d9369daf84ebf51cf150bec' }, { id: '5d9ad2d2aa0d5d10703c891c' }, { id: '5de8b25208d0612fe746d53c' }, { id: '5dea83cd08d0612fe746d5dc' }, { id: '5debd21b08d0612fe746d612' }, { id: '5debdce008d0612fe746d617' } ] }, { id: 3, name: 'New Column 100', topics: [ { id: '5d063832fde3f90bc0b9b7aa' }, { id: '5cffa4e7506d254b585c6eff' }, { id: '5caf49453bf61f160406dda9' }, { id: '5d60c51a6674b56d0a53b3cf' }, { id: '5d81c1640ce4e11366784cc5' }, { id: '5dfafebaad06b66a29c94f1d' }, { id: '5dea849e08d0612fe746d5dd' }, { id: '5dea865708d0612fe746d5de' }, { id: '5deb409908d0612fe746d5f5' }, { id: '5deb641808d0612fe746d5fe' }, { id: '5d81c1640ce4e11366784cc4' } ] } ] } }, { id: '5dc65e7b3b1e034680c4e928', name: 'Team 01', is_default: false, board: { id: '5dc65e7b3b1e034680c4e929', column_order: [ 0, 1 ], columns: [ { id: -1, name: 'Backlog', topics: [] }, { id: -2, name: 'Archive', topics: [] }, { id: 0, name: 'In Progress', topics: [] }, { id: 1, name: 'Done', topics: [] } ] } } ], attachements: [], label_id: 0, labels: [], milestone_id: 5, milestones: [ { id: 1, name: 'Sprint #1', start_date: '2019-05-12T18:00:00.000Z', end_date: '2019-05-30T18:00:00.000Z' }, { id: 5, name: 'Sprint 2' } ], phase_id: 4, phases: [ { id: 1, name: 'adfasdf hjkkjklj' } ], lot_id: 1, lots: [ { id: 1, name: 'adfadf' } ], priority_id: 0, priorities: [], description: 'adsfasdf asd fad fasdf asdf', photo: 'aaa892df-e52f-40e2-a436-f9a3822e1247/-/crop/3456x3456/745,0/-/preview/', id: '5ae834fe1494ab11b0b7028e' }; var myCopy = null;
Tests:
Lodash cloneDeep
myCopy = _.cloneDeep(project);
Json parse clone
myCopy = JSON.parse(JSON.stringify(project));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Lodash cloneDeep
Json parse clone
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
Based on the provided data, I will assume that the task is to compare the execution time of two different methods for cloning a JavaScript object. **Task:** Create a new JavaScript function that compares the execution time of two methods for cloning a JavaScript object: `_.cloneDeep` from Lodash and `JSON.parse(JSON.stringify())`. The function should take an input object `project`, create two copies using each method, and return the execution times for both methods. **Code:** ```javascript function compareCloningMethods(project) { const lodashClone = _.cloneDeep(project); const jsonClone = JSON.parse(JSON.stringify(project)); const startLodash = performance.now(); for (let i = 0; i < 10000; i++) { // do nothing, just iterate } const endLodash = performance.now(); const startJson = performance.now(); for (let i = 0; i < 10000; i++) { // do nothing, just iterate } const endJson = performance.now(); return { lodash: (endLodash - startLodash) / 10000, json: (endJson - startJson) / 10000 }; } // Example usage: const project = JSON.parse(JSON.stringify({ // your object data here })); // note: this is not the original object, but a copy const result = compareCloningMethods(project); console.log(`Lodash cloneDeep execution time: ${result.lodash}ms`); console.log(`JSON.parse(JSON.stringify()) execution time: ${result.json}ms`); ``` **Note:** The `for` loops are used to create workloads for each method, as the actual cloning process is not necessary. The timing is measured using `performance.now()`. Please let me know if this meets your requirements or if you need further assistance!
Related benchmarks:
cloneDeep vs JSON stringify + parse (long arr)
Lodash cloneDeep vs JSON Clone vs Ramda Clone for big Array
Deep cloning of arrays
Deep cloning of arrays with objects
Lodash cloneDeep vs JSON parse
Comments
Confirm delete:
Do you really want to delete benchmark?