Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
jsonstringify-vs-structuredclone-big
(version: 0)
Comparing performance of:
JSON stringify vs Structured Clone
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var MyObject = { "kind": "youtube#searchListResponse", "etag": "q4ibjmYp1KA3RqMF4jFLl6PBwOg", "nextPageToken": "CAUQAA", "regionCode": "NL", "pageInfo": { "totalResults": 1000000, "resultsPerPage": 5 }, "items": [ { "kind": "youtube#searchResult", "etag": "QCsHBifbaernVCbLv8Cu6rAeaDQ", "id": { "kind": "youtube#video", "videoId": "TvWDY4Mm5GM" }, "snippet": { "publishedAt": "2023-07-24T14:15:01Z", "channelId": "UCwozCpFp9g9x0wAzuFh0hwQ", "title": "3 Football Clubs Kylian Mbappe Should Avoid Signing ✍️❌⚽️ #football #mbappe #shorts", "description": "", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/TvWDY4Mm5GM/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/TvWDY4Mm5GM/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/TvWDY4Mm5GM/hqdefault.jpg", "width": 480, "height": 360 } }, "channelTitle": "FC Motivate", "liveBroadcastContent": "none", "publishTime": "2023-07-24T14:15:01Z" } }, { "kind": "youtube#searchResult", "etag": "0NG5QHdtIQM_V-DBJDEf-jK_Y9k", "id": { "kind": "youtube#video", "videoId": "aZM_42CcNZ4" }, "snippet": { "publishedAt": "2023-07-24T16:09:27Z", "channelId": "UCM5gMM_HqfKHYIEJ3lstMUA", "title": "Which Football Club Could Cristiano Ronaldo Afford To Buy? 💰", "description": "Sign up to Sorare and get a FREE card: https://sorare.pxf.io/NellisShorts Give Soraredata a go for FREE: ...", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/aZM_42CcNZ4/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/aZM_42CcNZ4/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/aZM_42CcNZ4/hqdefault.jpg", "width": 480, "height": 360 } }, "channelTitle": "John Nellis", "liveBroadcastContent": "none", "publishTime": "2023-07-24T16:09:27Z" } }, { "kind": "youtube#searchResult", "etag": "WbBz4oh9I5VaYj91LjeJvffrBVY", "id": { "kind": "youtube#video", "videoId": "wkP3XS3aNAY" }, "snippet": { "publishedAt": "2023-07-24T16:00:50Z", "channelId": "UC4EP1dxFDPup_aFLt0ElsDw", "title": "PAULO DYBALA vs THE WORLD'S LONGEST FREEKICK WALL", "description": "Can Paulo Dybala curl a football around the World's longest free kick wall? We met up with the World Cup winner and put him to ...", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/wkP3XS3aNAY/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/wkP3XS3aNAY/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/wkP3XS3aNAY/hqdefault.jpg", "width": 480, "height": 360 } }, "channelTitle": "Shoot for Love", "liveBroadcastContent": "none", "publishTime": "2023-07-24T16:00:50Z" } }, { "kind": "youtube#searchResult", "etag": "juxv_FhT_l4qrR05S1QTrb4CGh8", "id": { "kind": "youtube#video", "videoId": "rJkDZ0WvfT8" }, "snippet": { "publishedAt": "2023-07-24T10:00:39Z", "channelId": "UCO8qj5u80Ga7N_tP3BZWWhQ", "title": "TOP 10 DEFENDERS 2023", "description": "SoccerKingz https://soccerkingz.nl Use code: 'ILOVEHOF' to get 10% off. TOP 10 DEFENDERS 2023 Follow us! • Instagram ...", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/rJkDZ0WvfT8/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/rJkDZ0WvfT8/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/rJkDZ0WvfT8/hqdefault.jpg", "width": 480, "height": 360 } }, "channelTitle": "Home of Football", "liveBroadcastContent": "none", "publishTime": "2023-07-24T10:00:39Z" } }, { "kind": "youtube#searchResult", "etag": "wtuknXTmI1txoULeH3aWaOuXOow", "id": { "kind": "youtube#video", "videoId": "XH0rtu4U6SE" }, "snippet": { "publishedAt": "2023-07-21T16:30:05Z", "channelId": "UCwozCpFp9g9x0wAzuFh0hwQ", "title": "3 Things You Didn't Know About Erling Haaland ⚽️🇳🇴 #football #haaland #shorts", "description": "", "thumbnails": { "default": { "url": "https://i.ytimg.com/vi/XH0rtu4U6SE/default.jpg", "width": 120, "height": 90 }, "medium": { "url": "https://i.ytimg.com/vi/XH0rtu4U6SE/mqdefault.jpg", "width": 320, "height": 180 }, "high": { "url": "https://i.ytimg.com/vi/XH0rtu4U6SE/hqdefault.jpg", "width": 480, "height": 360 } }, "channelTitle": "FC Motivate", "liveBroadcastContent": "none", "publishTime": "2023-07-21T16:30:05Z" } } ] } var myCopy = null;
Tests:
JSON stringify
myCopy = JSON.parse(JSON.stringify(MyObject));
Structured Clone
myCopy = structuredClone(MyObject);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
JSON stringify
Structured Clone
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36
Browser/OS:
Chrome 125 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
JSON stringify
84384.1 Ops/sec
Structured Clone
52507.1 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
The benchmark results show that JSON.stringify has an execution time of approximately 84384.0625 executions per second, while structuredClone has an execution time of around 52507.0546875 executions per second. It appears that JSON.stringify is currently the faster method for serializing JavaScript objects to strings. However, it's worth noting that the performance difference between the two methods may not be significant in all cases, and other factors such as memory usage and compatibility with different browsers may also need to be considered when choosing a serialization method. If you're looking for alternative methods, there are other options available such as JSON.parse(JSON.stringify(MyObject)) or using a library like Lodash's _ cloneDeep function. These methods may have their own trade-offs in terms of performance, memory usage, and compatibility. In general, the choice of serialization method depends on the specific requirements of your application, including factors such as: * Performance: Do you need fast serialization and deserialization? * Memory usage: How much memory do you want to allocate for serialized data? * Compatibility: What browsers or environments will your application be running in? * Complexity: Are there any complex objects or nested structures that require special handling? Ultimately, the best method for serializing JavaScript objects will depend on the specific needs of your application.
Related benchmarks:
Lodash cloneDeep vs JSON Clone 121212121
structured clone vs JSON
JSON.stringify vs structuredClone with large Objects 2
JSON.stringify vs structuredClone vs cloneDeep
Comments
Confirm delete:
Do you really want to delete benchmark?