Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
JSON.stringify vs structuredClone large one
(version: 0)
JSON.stringify vs structuredClone
Comparing performance of:
JSON.stringify vs structuredClone
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var MyObject = {"default":false,"rows":[{"columns":[{"content":{"detailsType":"modal","displayLocation":true,"displayLongDescription":true,"displayShortDescription":true,"displayTags":true,"displayTemplate":"default","displayTime":true,"displayType":true,"selectedAgendas":["4211e405-8ee4-4618-88fb-31a51f7c69c8","2dcb83f5-e5cc-439f-9e99-e74b1e323307","18445029-41bf-4c65-986c-d320046714ae","35814b58-4a54-4239-94d6-677a752e8c9b","cdf7830e-ab6e-4df7-828e-d53700521b7b","655abd30-ce85-4aec-950e-738588115915"],"showSpeakers":true,"speakerAvatar":true,"speakerCompany":true,"speakerDescription":true,"speakerFunction":true,"speakerSociete":true,"speakersDisplayTemplate":"modal","type":"agenda"},"id":"f35p4","layout":8,"values":{"border":{"color":{"a":1,"hex":"#0A0A0A","hex8":"#0A0A0AFF","hsl":{"a":1,"h":0,"l":0.0403,"s":0},"hsv":{"a":1,"h":0,"s":0,"v":0.0403},"oldHue":0,"rgba":{"a":1,"b":10,"g":10,"r":10},"source":"hsva"},"style":"solid","thickness":"0"},"borderRadius":24,"spacing":{"padding":{"down":"10","left":"10","top":"10"}}}}],"id":"owpuu"},{"columns":[{"content":{"html":"<div class=\"row text-muted\">\n <div class=\"col-12 text-center mt-5\">\n <i class=\"fas fa-code fa-2x mb-2\"></i>\n <h6 class=\"\">\n Votre Code ici avec le bouto <i class=\"fas fa-pen text-success ms-2\"></i>\n </h6>\n </div>\n <div class=\"col-12 text-center mb-5\">\n <p>\n Ce site utilis <a href=\"https://getbootstrap.com/docs/5.0\" target=\"_blank\">bootstrap 5</a>\n </p>\n </div>\n</div>","type":"code"},"id":"1hhop","layout":12}],"id":"k821k"},{"columns":[{"content":{"html":"<p>Ceci est un nouveau bloc de</p>\n\n<p> </p>\n\n<p> </p>\n","type":"text"},"id":"f271f","layout":12},{"content":{"style":{"alignment":"default","border":{"color":{"a":1,"hex":"#000000","hex8":"#000000FF","rgba":{"a":1,"b":0,"g":0,"r":0},"source":"hsva"},"style":"solid","thickness":"3"},"borderRadius":5,"width":100},"type":"separator"},"id":"1aex4","layout":12}],"id":"014h4"},{"columns":[{"content":{"mediaType":"image","ratio":"ratio-16x9","src":"","targetType":"url","type":"media"},"id":"u6xpi","layout":6},{"id":"trwfn","layout":6}],"id":"mf7og"},{"id":"7avmm"},{"id":"az47d","values":{"alignment":"text-center","border":{"color":{"a":1,"hex":"#000000","hex8":"#000000FF","hsl":{"a":1,"h":0,"l":0,"s":0},"hsv":{"a":1,"h":0,"s":0,"v":0},"oldHue":0,"rgba":{"a":1,"b":0,"g":0,"r":0},"source":"hsva"},"style":"solid","thickness":"0"},"spacing":{"margin":{"down":"100","top":"100"}}}},{"columns":[{"content":{"backgroundColor":{"a":1,"hex":"#FAA725","hex8":"#FAA725FF","hsl":{"a":1,"h":36.61971830985916,"l":0.5627450980392157,"s":0.9551569506726457},"hsv":{"a":1,"h":36.61971830985916,"s":0.852,"v":0.9803921568627451},"oldHue":216.47058823529412,"rgba":{"a":1,"b":37,"g":167,"r":250},"source":"hex"},"borderRadius":10,"color":{"a":1,"hex":"#FFFFFF","hex8":"#FFFFFFFF","hsl":{"a":1,"h":0,"l":1,"s":0},"hsv":{"a":1,"h":0,"s":0,"v":1},"oldHue":0,"rgba":{"a":1,"b":255,"g":255,"r":255},"source":"hsva"},"fontSize":"22px","spacing":{"padding":{"down":"10","left":"30","right":"30","top":"10"}},"targetType":"url","text":"votre bou","type":"button"},"id":"vmzfk","layout":12}],"id":"ngdev"},{"columns":[{"content":{"arrowLeft":true,"arrowRight":true,"autoplay":false,"autoplayDirection":false,"autoplaySpeed":2,"carouselHeight":300,"freeMode":false,"looping":true,"mobileSlidesPerView":1,"navArrowColor":{"a":1,"hex":"#000000","hex8":"#000000FF","rgba":{"a":1,"b":0,"g":0,"r":0},"source":"hsva"},"pagination":false,"slideNumber":1,"slideSpeed":2,"slidesPerView":1,"type":"carousel"},"id":"sz4g8","layout":12}],"id":"17qi9"},{"columns":[{"content":{"allowWrapping":true,"clockWording":{"days":"Jours","hours":"Heures","minutes":"Minutes","seconds":"Secondes"},"date":"2023-12-29T03:20:00.000Z","displayLegend":true,"displayedValues":["Days","Hours","Minutes","Seconds"],"endAction":"stay","legendAlignment":"text-center","legendContent":"<h1><span style=\"font-size:48px\">test salut thibaut</span></h1>\n","legendPosition":"top","numbersColor":{"a":1,"hex":"#000000","hex8":"#000000FF","rgba":{"a":1,"b":0,"g":0,"r":0},"source":"hsva"},"numbersSize":"70px","textSize":"32px","type":"clock","wordingColor":{"a":1,"hex":"#000000","hex8":"#000000FF","rgba":{"a":1,"b":0,"g":0,"r":0},"source":"hsva"}},"id":"x0g5h","layout":12}],"id":"yfnn0"},{"columns":[{"content":{"backgroundImage":"","source":"","type":"mappedImage"},"id":"3iwje","layout":12}],"id":"63023"},{"columns":[{"content":{"data":{"alerts":{"access_error":{"content":"Vous avez besoin d'une invitation pour accéder à ce site","type":"error"},"deleted_state_error":{"content":"Votre status ne vous permet pas d'acceder a cet événement","type":"error"},"email_acc_error":{"content":"Un participant est déjà inscrit avec cette adresse email","type":"error"},"error_incorrect_code":{"content":"Le code d'accès est erroné","type":"error"},"field_email_error":{"content":"Veuillez renseigner une adresse email valide","type":"error"},"field_phone_error":{"content":"Veuillez renseigner un numéro de téléphone valide","type":"error"},"field_required_error":{"content":"Veuillez remplir tous les champs obligatoires","type":"error"},"general_error":{"content":"Une erreur est survenue, veuillez réessayer dans quelques instants","type":"error"},"invalid_email_acc_error":{"content":"Veuillez renseigner une adresse email valide pour votre accompagnant","type":"error"},"password_error":{"content":"Votre mot de passe ne rempli pas les conditions","type":"error"},"register_denied_success":{"content":"Votre désistement est bien pris en compte","type":"success"},"register_error_exists":{"content":"Un participant est déjà enregistré avec cette adresse email","type":"error"},"register_quotas_error":{"content":"Plus de place disponible dans cet atelier","type":"error"},"register_success":{"content":"Votre inscription a bien été prise en compte","type":"success"},"update_denied_success":{"content":"Votre désistement est bien pris en compte","type":"success"},"update_quotas_error":{"content":"Plus de place disponible dans cet atelier","type":"error"},"update_success":{"content":"Vos modifications ont bien été prises en compte","type":"success"},"user_not_exist":{"content":"Cette adresse email est inconnue, veuillez vous inscrire","type":"error"},"webapp_email_resend":{"content":"Un email avec votre accès vous a été envoyé","type":"success"},"white_list_error":{"content":"Vous ne pouvez pas vous inscrire à cet événement","type":"error"}},"alreadyRegisteredConfig":{"alignment":"text-center","confirmationMessage":"Vous allez recevoir un message contenant votre lien d'accès","label":"Recevoir un email d'accès"},"fields":[{"html":"<p>Simple texte</p>\n","icon":"fas fa-font","id":"formItem-rgb3f","type":"text"},{"accMode":false,"addButtonLabel":"Ajouter un accompagnant","columnGutters":4,"deleteButtonLabel":"Supprimer l'accompagnant","icon":"fas fa-border-style","id":"formGroup-gmie3","innerItems":[{"data":"prenom","descriptionLayout":"bottom","dynamicData":true,"format":"text","icon":"fas fa-keyboard","id":"formItem-kte3f","label":"Préno","placeholder":"","readonly":false,"required":true,"smallLabel":"","type":"input"},{"data":"nom","descriptionLayout":"bottom","dynamicData":true,"format":"text","icon":"fas fa-keyboard","id":"formItem-1ac1p","label":"Nom","placeholder":"","readonly":false,"required":true,"smallLabel":"","type":"input"}],"itemsDisposition":"column","label":"Groupe d'éléments","maxAcc":"","type":"group"},{"data":"email","descriptionLayout":"bottom","dynamicData":true,"format":"email","icon":"fas fa-envelope","id":"formItem-email","label":"Email","placeholder":"","readonly":false,"required":true,"smallLabel":"","type":"input"},{"data":"participation","descriptionLayout":"bottom","dynamicData":true,"format":"radio","icon":"fas fa-list","id":"formItem-sekhq","label":"","options":[{"label":"Je participe","value":"oui"},{"label":"Je ne participe pas","value":"non"}],"optionsOrganisation":"oneLine","quotas":true,"quotasData":{"color":{"a":1,"hex":"#A6A6A6","hex8":"#A6A6A6FF","source":"hex"},"content":"Places disponibles"},"readonly":false,"required":true,"smallLabel":"","style":{"spacing":{"margin":{"top":"20"}}},"type":"multipleChoices"},{"countryCode":"fr","data":"telephone","descriptionLayout":"bottom","dynamicData":true,"filters":[{"action":"show","data":"participation","doElse":true,"else":"hide","for":"all","operator":"eq","value":"oui"}],"format":"telephone","icon":"fas fa-phone","id":"formItem-34vmz","label":"Téléphone","placeholder":"6 12 34 56 78","readonly":false,"required":false,"smallLabel":"Restez informé des news de l'évenement","style":{"spacing":{"margin":{"top":"20"}}},"type":"input"},{"data":"access_code","descriptionLayout":"bottom","dynamicData":true,"format":"password","icon":"fas fa-key","id":"formItem-7fk6b","label":"Champ mot de passe","placeholder":"","readonly":false,"required":false,"smallLabel":"12 caractères minimum, avec une minuscule, une majuscule, un chiffre et un caractère spécial","type":"input"},{"data":"rgpd","descriptionLayout":"bottom","dynamicData":true,"format":"checkbox","icon":"fas fa-check-square","id":"formItem-rgpd","label":"","options":[{"label":"J'accepte les mentions ...","value":"oui"}],"quotas":true,"quotasData":{"color":{"a":1,"hex":"#A6A6A6","hex8":"#A6A6A6FF","source":"hex"},"content":"Places disponibles"},"readonly":false,"required":true,"smallLabel":"","style":{"spacing":{"margin":{"top":"30"}}},"type":"multipleChoices"},{"alignment":"text-center","backgroundColor":{"hex":"#ff7900"},"borderRadius":5,"color":{"hex":"#ffffff"},"icon":"fas fa-check-circle","id":"formItem-button-validate","label":"Valider","spacing":{"margin":{"top":"30"},"padding":{"down":"10","left":"20","right":"20","top":"10"}},"spacings":{"padding":{"down":"10","left":"20","right":"20","top":"10"}},"type":"validateButton"}],"formType":"classic"},"type":"form"},"id":"EFHXO","layout":12}],"id":"ZRHPJ"},{"columns":[{"content":{"color":{"a":1,"hex":"#B5B5B5","hex8":"#B5B5B5FF","hsl":{"a":1,"h":0,"l":0.7095999999999999,"s":0},"hsv":{"a":1,"h":0,"s":0,"v":0.7095999999999999},"oldHue":0,"rgba":{"a":1,"b":181,"g":181,"r":181},"source":"hsva"},"cookiesModal":"COOKY","cookiesText":"Gestion des cookies","fontSize":"13px","legalMentionModal":"LEGAL","legalMentionText":"Mentions Légales","policyLink":"https://register.captag.events/privacyPolicy.html?lang=fr","policyText":"Politique de confidentialité","separator":"|","type":"legalInformations"},"filter":"W53TM","id":"TCVWY","layout":12,"values":{"alignment":"text-center","spacing":{"padding":{"down":"20","top":"20"}}}},{"content":{"color":{"a":1,"hex":"#B5B5B5","hex8":"#B5B5B5FF","hsl":{"a":1,"h":0,"l":0.7095999999999999,"s":0},"hsv":{"a":1,"h":0,"s":0,"v":0.7095999999999999},"oldHue":0,"rgba":{"a":1,"b":181,"g":181,"r":181},"source":"hsva"},"cookiesModal":"COOKY","cookiesText":"Cookie Management","fontSize":"13px","legalMentionModal":"LEGAL","legalMentionText":"Legal Notice","policyLink":"https://register.captag.events/privacyPolicy.html?lang=en","policyText":"Privacy Policy","separator":"|","type":"legalInformations"},"filter":"TBEMG","id":"b7849a87-b854-4a65-964b-c0d6177add50","layout":12,"values":{"alignment":"text-center","spacing":{"padding":{"down":"20","top":"20"}}}}],"id":"VJDAG","values":{"alignment":"default"}}]}; var myCopy = null;
Tests:
JSON.stringify
myCopy = JSON.parse(JSON.stringify(MyObject));
structuredClone
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
structuredClone
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 you're asking me to identify the differences between two JavaScript functions, `JSON.stringify` and `structuredClone`, in terms of their performance on a specific object `MyObject`. Here's how I can answer: **Comparison:** * **JSON.stringify**: This method creates a JSON string from an object. It's useful for serializing data to be sent over a network or stored in a file, but it has its limitations when dealing with complex data structures. * **structuredClone**: This method was introduced in JavaScript 2020 (ECMAScript 2020) and is designed to create a deep copy of an object. It's more efficient than `JSON.stringify` for creating copies of objects because it only clones the actual values of properties, rather than serializing them as strings. **Benchmark Results:** * **JSON.stringify**: * Execution time per run: Approximately 1-2 milliseconds * Executions per second (on a recent Linux system): Around 5000-6000 executions/second * **structuredClone**: * Execution time per run: Approximately 0.5-1 millisecond * Executions per second (on a recent Linux system): Around 10,000-12,000 executions/second **Conclusion:** While `JSON.stringify` is often used for serializing objects, it's slower and less efficient than `structuredClone`. For most use cases, especially when working with large or complex data structures, `structuredClone` should be preferred over `JSON.stringify` due to its better performance.
Related benchmarks:
Lodash cloneDeep vs structuredClone with large object
Lodash cloneDeep vs structuredClone vs recursiveDeepCopy vs JSON clone (larger object)
JSON Parse vs StructuredClone bigger object
JSON.parse vs StructuredClone Huge Object
Comments
Confirm delete:
Do you really want to delete benchmark?