Object Deep Clone Performance Test

Benchmark created on


Description

Testing different object clone methods like:

  • structuredClone()
  • JSON.stringify + JSON.parse

Setup

const testObject = {
  name: "John Doe",
  age: 30,
  skills: ["JavaScript", "React", "Node.js"],
  address: {
    city: "New York",
    zip: 12345,
    location: { lat: 40.7128, lng: -74.006 },
  },
  isActive: true,
};

Test runner

Ready to run.

Testing in
TestOps/sec
Using structuredClone()
structuredClone(testObject);
ready
Using JSON.stringify + JSON.parse
JSON.parse(JSON.stringify(testObject));
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.