Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
copy object
(version: 0)
Comparing performance of:
Object spread vs Object.assign vs JSON
Created:
4 years ago
by:
Guest
Jump to the latest result
Tests:
Object spread
const item = { "input": { "text": "how much is the fish", "intent": "Hyper", "intentScore": 1, "intentFlow": null, "slots": {}, "nlu": { "intentMapperResults": { "finalIntentName": "Hyper", "finalIntentScore": 1, "finalIntentNegated": false, "finalIntentConfirmationSentence": null, "finalIntentDisambiguationSentence": null, "highestFlow": "1111111122222223333333444444", "intentFlow": "1111111122222223333333444444", "intentId": "1111111122222223333333444444", "detailedSlots": {}, "tokens": [ "how", "much", "is", "the", "fish" ] }, "mode": "TextOnly", "type": "howQuestion", "question": { "exists": false }, "intentOutOfState": null, "currentTime": { "year": 2021, "month": 6, "day": 9, "hour": 18, "minute": 4, "second": 34, "milliseconds": 931, "weekday": 3, "dayOfWeek": "Wednesday", "ISODate": "2021-06-09T18:04:34+02:00", "plain": "June 9, 2021 6:04 PM", "grain": "second", "timezoneOffset": "Europe/Berlin" }, }, "context": { "best": { "stuff": "Hyper Hyper" }, "lastText": "hi" } } } const final = { ...item }
Object.assign
const item = { "input": { "text": "how much is the fish", "intent": "Hyper", "intentScore": 1, "intentFlow": null, "slots": {}, "nlu": { "intentMapperResults": { "finalIntentName": "Hyper", "finalIntentScore": 1, "finalIntentNegated": false, "finalIntentConfirmationSentence": null, "finalIntentDisambiguationSentence": null, "highestFlow": "1111111122222223333333444444", "intentFlow": "1111111122222223333333444444", "intentId": "1111111122222223333333444444", "detailedSlots": {}, "tokens": [ "how", "much", "is", "the", "fish" ] }, "mode": "TextOnly", "type": "howQuestion", "question": { "exists": false }, "intentOutOfState": null, "currentTime": { "year": 2021, "month": 6, "day": 9, "hour": 18, "minute": 4, "second": 34, "milliseconds": 931, "weekday": 3, "dayOfWeek": "Wednesday", "ISODate": "2021-06-09T18:04:34+02:00", "plain": "June 9, 2021 6:04 PM", "grain": "second", "timezoneOffset": "Europe/Berlin" }, }, "context": { "best": { "stuff": "Hyper Hyper" }, "lastText": "hi" } } } const final = Object.assign(item)
JSON
const item = { "input": { "text": "how much is the fish", "intent": "Hyper", "intentScore": 1, "intentFlow": null, "slots": {}, "nlu": { "intentMapperResults": { "finalIntentName": "Hyper", "finalIntentScore": 1, "finalIntentNegated": false, "finalIntentConfirmationSentence": null, "finalIntentDisambiguationSentence": null, "highestFlow": "1111111122222223333333444444", "intentFlow": "1111111122222223333333444444", "intentId": "1111111122222223333333444444", "detailedSlots": {}, "tokens": [ "how", "much", "is", "the", "fish" ] }, "mode": "TextOnly", "type": "howQuestion", "question": { "exists": false }, "intentOutOfState": null, "currentTime": { "year": 2021, "month": 6, "day": 9, "hour": 18, "minute": 4, "second": 34, "milliseconds": 931, "weekday": 3, "dayOfWeek": "Wednesday", "ISODate": "2021-06-09T18:04:34+02:00", "plain": "June 9, 2021 6:04 PM", "grain": "second", "timezoneOffset": "Europe/Berlin" }, }, "context": { "best": { "stuff": "Hyper Hyper" }, "lastText": "hi" } } } const final = JSON.parse(JSON.stringify(item));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Object spread
Object.assign
JSON
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):
It seems like we're dealing with benchmark results! Let's take a closer look: **Benchmark Results:** There are three benchmark results listed, each representing a different test (Object spread, Object.assign, and JSON). * **Test 1: Object spread** + RawUAString: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36" + Browser: Chrome 90 + DevicePlatform: Desktop + OperatingSystem: Linux + ExecutionsPerSecond: 520165.0625 * **Test 2: Object.assign** + RawUAString: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36" + Browser: Chrome 90 + DevicePlatform: Desktop + OperatingSystem: Linux + ExecutionsPerSecond: 460265.09375 * **Test 3: JSON** + RawUAString: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36" + Browser: Chrome 90 + DevicePlatform: Desktop + OperatingSystem: Linux + ExecutionsPerSecond: 38287.4453125 These results seem to show the benchmarking performance of different JavaScript operations on a specific browser and device combination. * The Object spread test shows high execution rates, indicating fast performance. * The Object.assign test also performs well but at slightly lower rates than Object spread. * The JSON test is the slowest, with very low execution rates. What would you like to know or discuss about these results?
Related benchmarks:
JS object copy spread vs assign
JS object copy spread vs assign spin@
Object Deep Copy Test3
lodash _.cloneDeep() vs deppClone()
Object cloning with Lodash clone vs ES6 object spread vs ES6 Object.assign vs Json copy
Comments
Confirm delete:
Do you really want to delete benchmark?