Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Compare deep copy of object
(version: 0)
Compare deep copy of object
Comparing performance of:
recursive vs jsonDeepCopy vs lodash
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
function recursiveDeepCopy(obj) { return Object.keys(obj).reduce((v, d) => Object.assign(v, { [d]: (obj[d].constructor === Object) ? recursiveDeepCopy(obj[d]) : obj[d] }), {}); } function jsonDeepCopy(o) { return JSON.parse(JSON.stringify(o)); } var dimensions = { "dimensions": [{ "runtime": { "common": { "client": null, "server": null } } }, { "device": { "android": null, "blackberry": null, "iemobile": null, "iphone": null, "ipad": null, "kindle": null, "opera-mini": null, "palm": null } }, { "environment": { "development": { "dev": null, "test": null }, "production": { "stage": null, "prod": null } } }, { "lang": { "ar": { "ar-JO": null, "ar-MA": null, "ar-SA": null, "ar-EG": null }, "bn": { "bn-IN": null }, "ca": { "ca-ES": null }, "cs": { "cs-CZ": null }, "da": { "da-DK": null }, "de": { "de-AT": null, "de-DE": null }, "el": { "el-GR": null }, "en": { "en-AU": null, "en-BG": null, "en-CA": null, "en-GB": null, "en-GY": null, "en-HK": null, "en-IE": null, "en-IN": null, "en-MY": null, "en-NZ": null, "en-PH": null, "en-SG": null, "en-US": null, "en-ZA": null }, "es": { "es-AR": null, "es-BO": null, "es-CL": null, "es-CO": null, "es-EC": null, "es-ES": null, "es-MX": null, "es-PE": null, "es-PY": null, "es-US": null, "es-UY": null, "es-VE": null }, "fi": { "fi-FI": null }, "fr": { "fr-BE": null, "fr-CA": null, "fr-FR": null, "fr-GF": null }, "hi": { "hi-IN": null }, "hu": { "hu-HU": null }, "id": { "id-ID": null }, "it": { "it-IT": null }, "ja": { "ja-JP": null }, "kn": { "kn-IN": null }, "ko": { "ko-KR": null }, "ml": { "ml-IN": null }, "mr": { "mr-IN": null }, "ms": { "ms-MY": null }, "nb": { "nb-NO": null }, "nl": { "nl-BE": null, "nl-NL": null, "nl-SR": null }, "pl": { "pl-PL": null }, "pt": { "pt-BR": null }, "ro": { "ro-RO": null }, "ru": { "ru-RU": null }, "sv": { "sv-SE": null }, "ta": { "ta-IN": null }, "te": { "te-IN": null }, "th": { "th-TH": null }, "tr": { "tr-TR": null }, "vi": { "vi-VN": null }, "zh": { "zh-Hans": { "zh-Hans-CN": null }, "zh-Hant": { "zh-Hant-HK": null, "zh-Hant-TW": null } } } }] }
Tests:
recursive
var dimensionsCopy = recursiveDeepCopy(dimensions);
jsonDeepCopy
var dimensionsCopy = jsonDeepCopy(dimensions);
lodash
var dimensionsCopy = _.cloneDeep(dimensions);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
recursive
jsonDeepCopy
lodash
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):
I'll do my best to provide an answer. It appears that you have provided two JSON-like strings: 1. A string representing an object with various keys (e.g., `"hu-HU"`, `"id-ID"`, etc.) and values, including nulls. The object seems to be a language code object. 2. Another string representing an array of objects, each containing information about benchmark tests: * `Benchmark Definition`: A JavaScript statement that clones or copies the `dimensions` object using different methods (e.g., `recursiveDeepCopy`, `jsonDeepCopy`, `_`. * `Test Name`: The name of the test being run. 3. Two more strings representing raw UA strings and metadata about benchmark runs: * `RawUAString`: A string representing a user agent. * `Browser`, `DevicePlatform`, `OperatingSystem`, `ExecutionsPerSecond`, and `TestName` fields: Metadata about the browser, device platform, operating system, execution rate, and test name. To answer your question, it's challenging without more context. However, I can try to provide some insights: * The language code object seems to be a collection of languages with their corresponding codes. * The benchmark tests seem to be comparing different methods for cloning or copying the `dimensions` object. * The raw UA strings and metadata suggest that these tests are being run on various devices and browsers. If you could provide more context or clarify what you're trying to accomplish, I'd be happy to help further!
Related benchmarks:
Object Deep Copy
Object Deep Copy test
Object Deep Copy e
Object Deep Copy 2
Object Deep Copy vs structuredClone
Comments
Confirm delete:
Do you really want to delete benchmark?