Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
fast_deep_equal - lodash.isEqual diff objects
(version: 0)
Comparing performance of:
lodash vs stringify
Created:
5 years ago
by:
Guest
Jump to the latest result
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);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
lodash
stringify
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 preparing for a JavaScript benchmarking test, specifically comparing the performance of two functions: `lodash` and `JSON.stringify`. Here are some steps to help you prepare: 1. **Ensure your JavaScript environment is set up correctly**: Make sure you have Node.js installed on your machine, as well as a code editor or IDE. 2. **Write a benchmarking script using Lodash**: Use the following code as a starting point for your benchmarking script: ```javascript const _ = require('lodash'); // Your test data (foo1 and bar1) const foo1 = { ... }; const bar1 = { ... }; // Benchmark function function benchmark() { const start = performance.now(); _.isEqual(foo1, bar1); const end = performance.now(); return end - start; } // Stringify benchmark function function stringifyBenchmark() { const start = performance.now(); JSON.stringify(foo1) === JSON.stringify(bar1); const end = performance.now(); return end - start; } // Run benchmarks and log results console.log('Benchmarking Lodash...'); const lodashResult = benchmark(); console.log('Benchmarking Stringify...'); const stringifyResult = stringifyBenchmark(); console.log(`Lodash result: ${lodashResult}`); console.log(`Stringify result: ${stringifyResult}`); ``` 3. **Run your script**: Run the script you've created, and it should output the execution times for both benchmarks. 4. **Compare results with latest benchmark result**: Compare the results from your script to the latest benchmark result provided in the prompt. This will help you understand the performance difference between `lodash` and `JSON.stringify`. 5. **Analyze results**: Take a closer look at the execution times to determine which function is performing better. 6. **Consider optimizations**: If necessary, consider optimizing either function to improve performance. However, keep in mind that optimizations may impact code readability or maintainability.
Related benchmarks:
Lodash.isEqual vs JSON.stringify Equality Comparison for deeply nested objects.
fast_deep_equal - lodash.isEqual same objects simpled test
Lodash.isEqual vs JSON.stringify Equality Comparison for Shallow Array of Objects.
Yepo_deepEqual vs. lodash.isEqual v1.1
Comments
Confirm delete:
Do you really want to delete benchmark?