Memo

Benchmark created on


Setup

function isDeepEqual(objA, objB) {
    // 1. Strict equality check for primitives and same object references
    if (objA === objB) {
      return true;
    }

    // 2. Check for null, undefined, or non-object types. If one is an object but the
    //    other isn't (or is null), they're not equal.
    if (typeof objA !== 'object' || typeof objB !== 'object' || objA === null || objB === null) {
      return false;
    }

    // 3. Compare the number of keys. If different, they can't be equal.
    const keysA = Object.keys(objA);
    const keysB = Object.keys(objB);

    if (keysA.length !== keysB.length) {
      return false;
    }

    // 4. Recursively compare the value of each key.
    for (const key of keysA) {
      if (!keysB.includes(key) || !this.isDeepEqual(objA[key], objB[key])) {
        return false;
      }
    }

    return true;
  }
}

const data = {
  "cmsName": "Main footer",
  "banner": "&lt;p&gt;Share your thoughts, and help us improve the GBO Growth experience.&nbsp;&nbsp;<a href=\"https://forms.gle/xPk2NiKXymF9Tjjo6\" target=\"_blank\" rel=\"noopener\">Submit feedback</a>&lt;/p&gt;",
  "links": [
    {
      "text": "About Google",
      "url": "https://about.google/",
      "openInNewTab": false,
      "subNavItems": []
    },
    {
      "text": "Google products",
      "url": "https://about.google/products/",
      "openInNewTab": false,
      "subNavItems": []
    },
    {
      "text": "Privacy",
      "url": "https://policies.google.com/privacy",
      "openInNewTab": false,
      "subNavItems": []
    },
    {
      "text": "Terms",
      "url": "https://policies.google.com/terms",
      "openInNewTab": false,
      "subNavItems": []
    }
  ],
  "playbookCta": {
    "ctaText": "User Guide",
    "ctaUrl": "https://docs.google.com/presentation/d/1QNT6r3_dVxUepD7UcQLxO7HXti__g650FoA6BQT-I2Y/edit#slide=id.g30a43ad3772_0_0",
    "openInNewTab": true
  },
  "disclaimerText": "&lt;p&gt;<strong>Your journey, your data:</strong> The information you provide will be used only for personalizing your growth space experience, and will not be shared with others.&lt;br /&gt;Learn more about our data policies or request your data be removed by contacting our <a href=\"mailto:gbo-growth-support@google.com\" target=\"_blank\" rel=\"noopener\">support team</a>.&lt;/p&gt;",
  "sitemapLinks": [
    {
      "text": "Home",
      "url": "/",
      "openInNewTab": false,
      "subNavItems": [
        {
          "text": "Growth at GBO",
          "url": "/growth-at-gbo",
          "openInNewTab": false
        },
        {
          "text": "GBO Assist",
          "url": "/",
          "openInNewTab": false
        }
      ]
    },
    {
      "text": "Growth Plan",
      "url": "/growth-plan",
      "openInNewTab": false,
      "subNavItems": [
        {
          "text": "Learn",
          "url": "/growth-plan#learn",
          "openInNewTab": false
        },
        {
          "text": "Connect",
          "url": "/growth-plan#connect",
          "openInNewTab": false
        },
        {
          "text": "Explore",
          "url": "/growth-plan#explore",
          "openInNewTab": false
        }
      ]
    },
    {
      "text": "GBO Training",
      "url": "/",
      "openInNewTab": false,
      "subNavItems": [
        {
          "text": "Aspiring Leaders",
          "url": "/",
          "openInNewTab": false
        },
        {
          "text": "Leadership Plan",
          "url": "/",
          "openInNewTab": false
        },
        {
          "text": "AI Fluency",
          "url": "/",
          "openInNewTab": false
        }
      ]
    },
    {
      "text": "My Growth Space",
      "url": "/growth-space",
      "openInNewTab": false,
      "subNavItems": [
        {
          "text": "Career Development Plan",
          "url": "/growth-space#career-development-plan",
          "openInNewTab": false
        },
        {
          "text": "Reflections",
          "url": "/growth-space#reflections",
          "openInNewTab": false
        },
        {
          "text": "Personal Advisory Board",
          "url": "/growth-space#personal-advisory-board",
          "openInNewTab": false
        },
        {
          "text": "Bookmarks",
          "url": "/growth-space#bookmarks",
          "openInNewTab": false
        }
      ]
    },
    {
      "text": "Community",
      "url": "/growth-community",
      "openInNewTab": false,
      "subNavItems": [
        {
          "text": "Community",
          "url": "/growth-community",
          "openInNewTab": false
        },
        {
          "text": "Career Stories",
          "url": "/career-stories",
          "openInNewTab": false
        }
      ]
    }
  ]
}

Test runner

Ready to run.

Testing in
TestOps/sec
JSON.stringify
JSON.stringify(data);
ready
isDeepEqual
isDeepEqual(data, data);
ready

Revisions

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