fast_deep_equal - lodash.isEqual diff objects
Date tested:
4 years ago
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:81.0) Gecko/20100101 Firefox/81.0
Test name
Executions per second
lodash
162606.6 Ops/sec
stringify
20938.0 Ops/sec
Benchmark definition (click to collapse):
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
Script Preparation code:
var isArray = Array.isArray; var keyList = Object.keys; var hasProp = Object.prototype.hasOwnProperty; // 1 level deep window.foo1 = [ { "type": "Text", "version": "3.3.0", "left": 808, "top": 59, "width": 619.54101563, "height": 158.2, "fill": { "type": "linear", "coords": { "x1": 350.2961971670019, "y1": -72.14393167342442, "x2": 269.24481846299807, "y2": 230.3439316734244 }, "colorStops": [ { "offset": 0, "color": "rgb(0,241,3212)", "opacity": 1 }, { "offset": 1, "color": "rgb(250,14,14)", "opacity": 1 } ], "offsetX": 0, "offsetY": 0 }, "strokeDashArray": [0, 0], "scaleX": 1.49, "scaleY": 1.49, "shadow": { "color": "rgba(0,0,0,0.6)", "blur": 30, "offsetX": 0, "offsetY": 0, "affectStroke": false, "nonScaling": false }, "text": "Text with gradients&shadows", "fontSize": 70, "fontWeight": "500", "fontFamily": "Roboto", "lineHeight": 1, "textAlign": "center", "minWidth": 20, "splitByGrapheme": false, "customBulletStyle": ["👉"], "spaceAfterParagraph": 0, "contents": [ { "insert": "Text with gradients&shadows", "attributes": false } ], "canvasId": "c30e5c14-2e9b-453c-9c7b-000008dc7c5b", "editable": true, "evented": true, "leftIndent": 0, "selectable": true, "strokeStyle": "solid", "lockUniScaling": false, "": { "type": "title", "locked": false, "prevIndex": 0, "transformMatrix": [1.49, 0, 0, 1.49, -32.44179335564996, -306.5705] }, "perPixelTargetFind": false, "styleCase": "normal", "styles": {} }, { "type": "Text", "version": "3.3.0", "left": 808, "top": 386, "width": 619.54, "height": 79.1, "fill": "rgba(250,14,14,1)", "strokeDashArray": [0, 0], "scaleX": 1.49, "scaleY": 1.49, "shadow": { "color": "rgba(0,0,0,0.6)", "blur": 30, "offsetX": 0, "offsetY": -50, "affectStroke": false, "nonScaling": false }, "text": "Text with shadow", "fontSize": 70, "fontWeight": "500", "fontFamily": "Roboto", "lineHeight": 1, "textAlign": "center", "minWidth": 20, "splitByGrapheme": false, "customBulletStyle": ["👉"], "spaceAfterParagraph": 0, "contents": [{ "insert": "Text with shadow", "attributes": false }], "canvasId": "05432b94-89a0-4755-9f3d-088507c7620b", "editable": true, "evented": true, "leftIndent": 0, "selectable": true, "strokeStyle": "solid", "lockUniScaling": false, "": { "type": "title", "locked": false, "prevIndex": 0, "transformMatrix": [ 1.49, 0, 0, 1.49, -32.442549999999926, -38.499999999999964 ] }, "perPixelTargetFind": false, "styleCase": "normal", "styles": {} }, { "type": "Text", "version": "3.3.0", "left": 846, "top": 610, "width": 629.53, "height": 79.1, "fill": "rgba(250,14,14,1)", "strokeDashArray": [0, 0], "scaleX": 1.49, "scaleY": 1.49, "text": "Text with styles", "fontSize": 70, "fontWeight": "500", "fontFamily": "Roboto", "lineHeight": 1, "textAlign": "center", "minWidth": 20, "splitByGrapheme": false, "customBulletStyle": ["👉"], "spaceAfterParagraph": 0, "contents": [ { "insert": "Text", "attributes": { "underline": true } }, { "insert": " " }, { "insert": "with", "attributes": { "fontWeight": "122" } }, { "insert": " " }, { "insert": "styles", "attributes": { "fontStyle": "italic" } } ], "canvasId": "1faa113f-a785-4c9b-9a56-25a7bfc68867", "editable": true, "evented": true, "leftIndent": 0, "selectable": true, "strokeStyle": "solid", "lockUniScaling": false, "": { "type": "title", "locked": false, "prevIndex": 0, "transformMatrix": [ 1.49, 0, 0, 1.49, 13.000000000000057, 185.50000000000003 ] }, "perPixelTargetFind": false, "styleCase": "normal", "styles": {} }, { "type": "Text", "version": "3.3.0", "left": 858, "top": 790, "width": 629.53, "height": 79.1, "fill": "rgba(250,14,14,1)", "strokeDashArray": [0, 0], "scaleX": 1.49, "scaleY": 1.49, "shadow": { "color": "rgba(0,0,0,0.6)", "blur": 30, "offsetX": 0, "offsetY": -50, "affectStroke": false, "nonScaling": false }, "text": "Text with shadows", "fontSize": 70, "fontWeight": "500", "fontFamily": "Roboto", "lineHeight": 1, "textAlign": "center", "minWidth": 20, "splitByGrapheme": false, "customBulletStyle": ["👉"], "spaceAfterParagraph": 0, "contents": [ { "insert": "Text", "attributes": { "underline": true } }, { "insert": " " }, { "insert": "with", "attributes": { "fontWeight": "700" } }, { "insert": " " }, { "insert": "shadows", "attributes": { "fontStyle": "italic" } } ], "canvasId": "c82b2961-65d4-4827-bd94-64984d649dc5", "editable": true, "evented": true, "leftIndent": 0, "selectable": true, "strokeStyle": "solid", "lockUniScaling": false, "": { "type": "title", "locked": false, "prevIndex": 0, "transformMatrix": [ 1.49, 0, 0, 1.49, 25.000000000000057, 365.50000000000006 ] }, "perPixelTargetFind": false, "styleCase": "normal", "styles": {} } ] window.bar1 = [ { "type": "Text", "version": "3.3.0", "left": 808, "top": 59, "width": 619.54101563, "height": 158.2, "fill": { "type": "linear", "coords": { "x1": 350.2961971670019, "y1": -72.14393167342442, "x2": 269.24481846299807, "y2": 230.3439316734244 }, "colorStops": [ { "offset": 0, "color": "rgb(0,241,255)", "opacity": 1 }, { "offset": 1, "color": "rgb(250,14,14)", "opacity": 1 } ], "offsetX": 0, "offsetY": 0 }, "strokeDashArray": [0, 0], "scaleX": 1.49, "scaleY": 1.49, "shadow": { "color": "rgba(0,0,0,0.6)", "blur": 30, "offsetX": 0, "offsetY": 0, "affectStroke": false, "nonScaling": false }, "text": "Text with gradients&shadows", "fontSize": 70, "fontWeight": "500", "fontFamily": "Roboto", "lineHeight": 1, "textAlign": "center", "minWidth": 20, "splitByGrapheme": false, "customBulletStyle": ["👉"], "spaceAfterParagraph": 0, "contents": [ { "insert": "Text with gradients&shadows", "attributes": false } ], "canvasId": "c30e5c14-2e9b-453c-9c7b-000008dc7c5b", "editable": true, "evented": true, "leftIndent": 0, "selectable": true, "strokeStyle": "solid", "lockUniScaling": false, "": { "type": "title", "locked": false, "prevIndex": 0, "transformMatrix": [1.49, 0, 0, 1.49, -32.44179335564996, -306.5705] }, "perPixelTargetFind": false, "styleCase": "normal", "styles": {} }, { "type": "Text", "version": "3.3.0", "left": 808, "top": 386, "width": 619.54, "height": 79.1, "fill": "rgba(250,14,14,1)", "strokeDashArray": [0, 0], "scaleX": 1.49, "scaleY": 1.49, "shadow": { "color": "rgba(0,0,0,0.6)", "blur": 30, "offsetX": 0, "offsetY": -50, "affectStroke": false, "nonScaling": false }, "text": "Text with shadow", "fontSize": 70, "fontWeight": "500", "fontFamily": "Roboto", "lineHeight": 1, "textAlign": "center", "minWidth": 20, "splitByGrapheme": false, "customBulletStyle": ["👉"], "spaceAfterParagraph": 0, "contents": [{ "insert": "Text with shadow", "attributes": false }], "canvasId": "05432b94-89a0-4755-9f3d-088507c7620b", "editable": true, "evented": true, "leftIndent": 0, "selectable": true, "strokeStyle": "solid", "lockUniScaling": false, "": { "type": "title", "locked": false, "prevIndex": 0, "transformMatrix": [ 1.49, 0, 0, 1.49, -32.442549999999926, -38.499999999999964 ] }, "perPixelTargetFind": false, "styleCase": "normal", "styles": {} }, { "type": "Text", "version": "3.3.0", "left": 846, "top": 610, "width": 629.53, "height": 79.1, "fill": "rgba(250,14,14,1)", "strokeDashArray": [0, 0], "scaleX": 1.49, "scaleY": 1.49, "text": "Text with styles", "fontSize": 70, "fontWeight": "500", "fontFamily": "Roboto", "lineHeight": 1, "textAlign": "center", "minWidth": 20, "splitByGrapheme": false, "customBulletStyle": ["👉"], "spaceAfterParagraph": 0, "contents": [ { "insert": "Text", "attributes": { "underline": true } }, { "insert": " " }, { "insert": "with", "attributes": { "fontWeight": "700" } }, { "insert": " " }, { "insert": "styles", "attributes": { "fontStyle": "italic" } } ], "canvasId": "1faa113f-a785-4c9b-9a56-25a7bfc68867", "editable": true, "evented": true, "leftIndent": 0, "selectable": true, "strokeStyle": "solid", "lockUniScaling": false, "": { "type": "title", "locked": false, "prevIndex": 0, "transformMatrix": [ 1.49, 0, 0, 1.49, 13.000000000000057, 185.50000000000003 ] }, "perPixelTargetFind": false, "styleCase": "normal", "styles": {} }, { "type": "Text", "version": "3.3.0", "left": 858, "top": 790, "width": 629.53, "height": 79.1, "fill": "rgba(250,14,14,1)", "strokeDashArray": [0, 0], "scaleX": 1.49, "scaleY": 1.49, "shadow": { "color": "rgba(0,0,0,0.6)", "blur": 30, "offsetX": 0, "offsetY": -50, "affectStroke": false, "nonScaling": false }, "text": "Text with shadows", "fontSize": 70, "fontWeight": "500", "fontFamily": "Roboto", "lineHeight": 1, "textAlign": "center", "minWidth": 20, "splitByGrapheme": false, "customBulletStyle": ["👉"], "spaceAfterParagraph": 0, "contents": [ { "insert": "Text", "attributes": { "underline": true } }, { "insert": " " }, { "insert": "with", "attributes": { "fontWeight": "700" } }, { "insert": " " }, { "insert": "shadows", "attributes": { "fontStyle": "italic" } } ], "canvasId": "c82b2961-65d4-4827-bd94-64984d649dc5", "editable": true, "evented": true, "leftIndent": 0, "selectable": true, "strokeStyle": "solid", "lockUniScaling": false, "": { "type": "title", "locked": false, "prevIndex": 0, "transformMatrix": [ 1.49, 0, 0, 1.49, 25.000000000000057, 365.50000000000006 ] }, "perPixelTargetFind": false, "styleCase": "normal", "styles": {} } ] // 2 levels deep window.foo2 = { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } }; window.bar2 = { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } }; // 3 levels deep window.foo3 = { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } }; window.bar3 = { a: 1, b: 2, c: { a: 1, b: 2, c: { a: 1, b: 2 } } };
Tests:
lodash
_.isEqual(window.foo1, window.bar1)
stringify
JSON.stringify(window.foo1) === JSON.stringify(window.bar1);
Open this result on MeasureThat.net