Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash.isEqual vs JSON.stringify Equality big obj
(version: 0)
Test on isEqual performance
Comparing performance of:
_.isEqual vs JSON.stringify
Created:
2 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:
window.foo = { id: '37d018d4-83c0-4787-ae31-eee4481b9e47', number: 7, party: { id: '8e2ef5b6-4e54-44fc-ac19-0c79f6adce24', name: 'Аккаунты сервиса id:700 qa_no_sso_service', type: 'ACCOUNT', userIds: [ '24a188ac-fa0b-4e6d-bd0a-22d7bb60ce44', '79fb657c-9bc6-4123-a38d-cfa4ce5fbd53', '78c7822a-4c8c-4865-b107-05f787255867', '267bf6ce-bba3-434e-84de-f0fbe3ae8a18', ], }, users: [ { id: '78c7822a-4c8c-4865-b107-05f787255867', firstName: 'User', lastName: 'Gpn', middleName: null, company: { id: '31757dd0-b866-43c4-9d9b-c5385dcddac5', name: 'ООО "Газпромнефть-Нефтесервис"', taxNumber: '7728632093', type: 'DO', businessId: ' ', phoneReception: null, organizationFoundationDate: '11-09-2007', managerGeneral: null, industrialNumber: '783801001', primaryRegistrationNumber: '1077760003419', bankIdentificationCode: null, bankName: null, bankAccount: null, bankCorrespondentAccount: null, actualAddress: null, legalAddress: null, activityDirections: [], logoId: null, email: null, fax: null, }, position: 'EmployeeGPN', email: 'user.gpn@gmail.com', keycloakId: 'c97056b8-95f9-4a27-89e9-898ff2565c39', mobileNumber: '+71111111111', status: null, createDate: '2022-11-09T14:31:44+0000', updateDate: '2022-11-09T14:31:44+0000', deliveryNotify: null, businessId: null, roles: null, segment: null, }, { id: '267bf6ce-bba3-434e-84de-f0fbe3ae8a18', firstName: 'Иван', lastName: 'Петров', middleName: 'Сергеевич', company: { id: 'd219b8f1-09f0-4cdc-9443-7c0440463251', name: 'АО "Газпромнефть-Ноябрьскнефтегаз"', taxNumber: '8905000428', type: 'DO', businessId: '59', phoneReception: null, organizationFoundationDate: null, managerGeneral: null, industrialNumber: '997250001', primaryRegistrationNumber: '1028900703963', bankIdentificationCode: null, bankName: null, bankAccount: null, bankCorrespondentAccount: null, actualAddress: null, legalAddress: null, activityDirections: [], logoId: null, email: null, fax: null, }, position: 'Генеральный директор', email: 't_petrov.i@fsdfd.ru', keycloakId: '7bf1c3d1-9ce3-4aaf-bca9-2c580909dad8', mobileNumber: '+7-922-681-05', status: null, createDate: '2021-08-30T00:00:00+0000', updateDate: '2022-08-03T11:15:17+0000', deliveryNotify: null, businessId: null, roles: null, segment: null, }, { id: '79fb657c-9bc6-4123-a38d-cfa4ce5fbd53', firstName: 'Леонид', lastName: 'Тестов', middleName: null, company: { id: '1ecd7397-79ac-4bb4-aba3-c230ba4dc70c', name: 'ООО "Газпромнефть-Хантос"', taxNumber: '8618006063', type: 'DO', businessId: '1231211111', phoneReception: null, organizationFoundationDate: null, managerGeneral: null, industrialNumber: '997250001', primaryRegistrationNumber: '1058600001118', bankIdentificationCode: null, bankName: null, bankAccount: null, bankCorrespondentAccount: null, actualAddress: null, legalAddress: null, activityDirections: [], logoId: null, email: null, fax: null, }, position: 'тест', email: 'uumxez@mailto.plus', keycloakId: 'ef01cbe2-bb1e-4dd4-9771-2cc648e18f04', mobileNumber: '+71223333333', status: null, createDate: '2023-03-10T11:17:35+0000', updateDate: '2023-03-10T11:17:35+0000', deliveryNotify: null, businessId: null, roles: null, segment: null, }, { id: '24a188ac-fa0b-4e6d-bd0a-22d7bb60ce44', firstName: 'test1', lastName: 'test1', middleName: null, company: { id: '7ce9738d-f778-4dc1-8cb6-5bca59e917f4', name: 'Test-5', taxNumber: '2234332333', type: 'GPN', businessId: 'wd3df', phoneReception: null, organizationFoundationDate: null, managerGeneral: null, industrialNumber: '453333333', primaryRegistrationNumber: null, bankIdentificationCode: null, bankName: null, bankAccount: null, bankCorrespondentAccount: null, actualAddress: null, legalAddress: null, activityDirections: [], logoId: null, email: null, fax: null, }, position: 'erte4tr', email: 't_jdshf@mail.ru', keycloakId: 'e82334ae-b42a-40c6-842e-16a58ef100a7', mobileNumber: '+74444444444', status: null, createDate: '2022-11-25T08:28:36+0000', updateDate: '2022-11-25T08:28:36+0000', deliveryNotify: null, businessId: null, roles: null, segment: null, }, ], status: 'SUCCESS', type: 'ACCOUNT', partyName: 'Аккаунты сервиса id:700 qa_no_sso_service', author: { id: 'fb3a4b88-f2c1-437d-9aba-1164e5fbac93', firstName: 'provider', lastName: 'cdmz', middleName: null, company: { id: '1ecd7397-79ac-4bb4-aba3-c230ba4dc70c', name: 'ООО "Газпромнефть-Хантос"', taxNumber: '8618006063', type: 'DO', businessId: '1231211111', phoneReception: null, organizationFoundationDate: null, managerGeneral: null, industrialNumber: '997250001', primaryRegistrationNumber: '1058600001118', bankIdentificationCode: null, bankName: null, bankAccount: null, bankCorrespondentAccount: null, actualAddress: null, legalAddress: null, activityDirections: [], logoId: null, email: null, fax: null, }, position: 'авыф', email: 'cdmz_provider_bk@gpn.ru', keycloakId: 'cc8c281a-9318-4a40-b24e-d7dac787a06c', mobileNumber: '+79001112233', status: null, createDate: '2022-05-31T05:54:58+0000', updateDate: '2023-04-03T11:35:02+0000', deliveryNotify: null, businessId: null, roles: null, segment: null, }, createDate: '2023-07-03T12:09:49+0000', updateDate: '2023-07-03T12:53:18+0000', services: [ { id: '18357d51-53f6-4aea-ab7b-47878e2b9845', name: 'qa_no_sso_service', }, ], histories: [ { id: 'f7088d75-4b7a-47e2-adb7-afea23e81f11', partyRequestId: '37d018d4-83c0-4787-ae31-eee4481b9e47', status: 'NEW', authorId: 'fb3a4b88-f2c1-437d-9aba-1164e5fbac93', createDate: '2023-07-03T12:09:49+0000', updateDate: '2023-07-03T12:09:49+0000', }, { id: 'd9db8a8f-d8dd-4ebf-85f8-c612501b978c', partyRequestId: '37d018d4-83c0-4787-ae31-eee4481b9e47', status: 'ON_WORK', authorId: '101e1db3-4f41-419b-a7e4-c4097f205853', createDate: '2023-07-03T12:53:10+0000', updateDate: '2023-07-03T12:53:10+0000', }, { id: '3cf4a1db-5df3-4dac-8f11-5ab0545920de', partyRequestId: '37d018d4-83c0-4787-ae31-eee4481b9e47', status: 'SUCCESS', authorId: '101e1db3-4f41-419b-a7e4-c4097f205853', createDate: '2023-07-03T12:53:18+0000', updateDate: '2023-07-03T12:53:18+0000', }, ], }; window.bar = { id: '37d018d4-83c0-4787-ae31-eee4481b9e47', number: 7, party: { id: '8e2ef5b6-4e54-44fc-ac19-0c79f6adce24', name: 'Аккаунты сервиса id:700 qa_no_sso_service', type: 'ACCOUNT', userIds: [ '24a188ac-fa0b-4e6d-bd0a-22d7bb60ce44', '79fb657c-9bc6-4123-a38d-cfa4ce5fbd53', '78c7822a-4c8c-4865-b107-05f787255867', '267bf6ce-bba3-434e-84de-f0fbe3ae8a18', ], }, users: [ { id: '78c7822a-4c8c-4865-b107-05f787255867', firstName: 'User', lastName: 'Gpn', middleName: null, company: { id: '31757dd0-b866-43c4-9d9b-c5385dcddac5', name: 'ООО "Газпромнефть-Нефтесервис"', taxNumber: '7728632093', type: 'DO', businessId: ' ', phoneReception: null, organizationFoundationDate: '11-09-2007', managerGeneral: null, industrialNumber: '783801001', primaryRegistrationNumber: '1077760003419', bankIdentificationCode: null, bankName: null, bankAccount: null, bankCorrespondentAccount: null, actualAddress: null, legalAddress: null, activityDirections: [], logoId: null, email: null, fax: null, }, position: 'EmployeeGPN', email: 'user.gpn@gmail.com', keycloakId: 'c97056b8-95f9-4a27-89e9-898ff2565c39', mobileNumber: '+71111111111', status: null, createDate: '2022-11-09T14:31:44+0000', updateDate: '2022-11-09T14:31:44+0000', deliveryNotify: null, businessId: null, roles: null, segment: null, }, { id: '267bf6ce-bba3-434e-84de-f0fbe3ae8a18', firstName: 'Иван', lastName: 'Петров', middleName: 'Сергеевич', company: { id: 'd219b8f1-09f0-4cdc-9443-7c0440463251', name: 'АО "Газпромнефть-Ноябрьскнефтегаз"', taxNumber: '8905000428', type: 'DO', businessId: '59', phoneReception: null, organizationFoundationDate: null, managerGeneral: null, industrialNumber: '997250001', primaryRegistrationNumber: '1028900703963', bankIdentificationCode: null, bankName: null, bankAccount: null, bankCorrespondentAccount: null, actualAddress: null, legalAddress: null, activityDirections: [], logoId: null, email: null, fax: null, }, position: 'Генеральный директор', email: 't_petrov.i@fsdfd.ru', keycloakId: '7bf1c3d1-9ce3-4aaf-bca9-2c580909dad8', mobileNumber: '+7-922-681-05', status: null, createDate: '2021-08-30T00:00:00+0000', updateDate: '2022-08-03T11:15:17+0000', deliveryNotify: null, businessId: null, roles: null, segment: null, }, { id: '79fb657c-9bc6-4123-a38d-cfa4ce5fbd53', firstName: 'Леонид', lastName: 'Тестов', middleName: null, company: { id: '1ecd7397-79ac-4bb4-aba3-c230ba4dc70c', name: 'ООО "Газпромнефть-Хантос"', taxNumber: '8618006063', type: 'DO', businessId: '1231211111', phoneReception: null, organizationFoundationDate: null, managerGeneral: null, industrialNumber: '997250001', primaryRegistrationNumber: '1058600001118', bankIdentificationCode: null, bankName: null, bankAccount: null, bankCorrespondentAccount: null, actualAddress: null, legalAddress: null, activityDirections: [], logoId: null, email: null, fax: null, }, position: 'тест', email: 'uumxez@mailto.plus', keycloakId: 'ef01cbe2-bb1e-4dd4-9771-2cc648e18f04', mobileNumber: '+71223333333', status: null, createDate: '2023-03-10T11:17:35+0000', updateDate: '2023-03-10T11:17:35+0000', deliveryNotify: null, businessId: null, roles: null, segment: null, }, { id: '24a188ac-fa0b-4e6d-bd0a-22d7bb60ce44', firstName: 'test1', lastName: 'test1', middleName: null, company: { id: '7ce9738d-f778-4dc1-8cb6-5bca59e917f4', name: 'Test-5', taxNumber: '2234332333', type: 'GPN', businessId: 'wd3df', phoneReception: null, organizationFoundationDate: null, managerGeneral: null, industrialNumber: '453333333', primaryRegistrationNumber: null, bankIdentificationCode: null, bankName: null, bankAccount: null, bankCorrespondentAccount: null, actualAddress: null, legalAddress: null, activityDirections: [], logoId: null, email: null, fax: null, }, position: 'erte4tr', email: 't_jdshf@mail.ru', keycloakId: 'e82334ae-b42a-40c6-842e-16a58ef100a7', mobileNumber: '+74444444444', status: null, createDate: '2022-11-25T08:28:36+0000', updateDate: '2022-11-25T08:28:36+0000', deliveryNotify: null, businessId: null, roles: null, segment: null, }, ], status: 'SUCCESS', type: 'ACCOUNT', partyName: 'Аккаунты сервиса id:700 qa_no_sso_service', author: { id: 'fb3a4b88-f2c1-437d-9aba-1164e5fbac93', firstName: 'provider', lastName: 'cdmz', middleName: null, company: { id: '1ecd7397-79ac-4bb4-aba3-c230ba4dc70c', name: 'ООО "Газпромнефть-Хантос"', taxNumber: '8618006063', type: 'DO', businessId: '1231211111', phoneReception: null, organizationFoundationDate: null, managerGeneral: null, industrialNumber: '997250001', primaryRegistrationNumber: '1058600001118', bankIdentificationCode: null, bankName: null, bankAccount: null, bankCorrespondentAccount: null, actualAddress: null, legalAddress: null, activityDirections: [], logoId: null, email: null, fax: null, }, position: 'авыф', email: 'cdmz_provider_bk@gpn.ru', keycloakId: 'cc8c281a-9318-4a40-b24e-d7dac787a06c', mobileNumber: '+79001112233', status: null, createDate: '2022-05-31T05:54:58+0000', updateDate: '2023-04-03T11:35:02+0000', deliveryNotify: null, businessId: null, roles: null, segment: null, }, createDate: '2023-07-03T12:09:49+0000', updateDate: '2023-07-03T12:53:18+0000', services: [ { id: '18357d51-53f6-4aea-ab7b-47878e2b9845', name: 'qa_no_sso_service', }, ], histories: [ { id: 'f7088d75-4b7a-47e2-adb7-afea23e81f11', partyRequestId: '37d018d4-83c0-4787-ae31-eee4481b9e47', status: 'NEW', authorId: 'fb3a4b88-f2c1-437d-9aba-1164e5fbac93', createDate: '2023-07-03T12:09:49+0000', updateDate: '2023-07-03T12:09:49+0000', }, { id: 'd9db8a8f-d8dd-4ebf-85f8-c612501b978c', partyRequestId: '37d018d4-83c0-4787-ae31-eee4481b9e47', status: 'ON_WORK', authorId: '101e1db3-4f41-419b-a7e4-c4097f205853', createDate: '2023-07-03T12:53:10+0000', updateDate: '2023-07-03T12:53:10+0000', }, { id: '3cf4a1db-5df3-4dac-8f11-5ab0545920de', partyRequestId: '37d018d4-83c0-4787-ae31-eee4481b9e47', status: 'SUCCESS', authorId: '101e1db3-4f41-419b-a7e4-c4097f205853', createDate: '2023-07-03T12:53:18+0000', updateDate: '2023-07-03T12:53:18+0000', }, ], };
Tests:
_.isEqual
_.isEqual(window.foo, window.bar)
JSON.stringify
JSON.stringify(window.foo) === JSON.stringify(window.bar);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
_.isEqual
JSON.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):
To answer this question, we need to parse the given JSON data and then run some benchmarks on it. Here is the code that accomplishes this: ```javascript const jsonData = { foo: 'bar', bar: 'foo' }; const lodash = require('lodash'); console.log(lodash.isEqual(window.foo, window.bar)); console.log(JSON.stringify(window.foo) === JSON.stringify(window.bar)); ``` To run the benchmarks, we can use the `bench.js` library. First, we need to install it: ```bash npm install benchjs ``` Then, we can create a benchmark file (`benchmark.js`) with the following content: ```javascript const bench = require('bench'); bench({ name: '_.isEqual', fn: function() { console.log(lodash.isEqual(window.foo, window.bar)); }, iterations: 1000, }); bench({ name: 'JSON.stringify', fn: function() { console.log(JSON.stringify(window.foo) === JSON.stringify(window.bar)); }, iterations: 1000, }); ``` Finally, we can run the benchmarks using the `bench` command: ```bash bench benchmark.js ``` This will output the results of each benchmark, including the number of executions per second. As for the code, here's how it can be modified to match your test cases: ```javascript const jsonData = { foo: 'bar', bar: 'foo' }; const lodash = require('lodash'); console.log(lodash.isEqual(window.foo, window.bar)); console.log(JSON.stringify(window.foo) === JSON.stringify(window.bar)); ``` And the `benchmark.js` file remains the same.
Related benchmarks:
Lodash.isEqual vs JSON.stringify Equality Comparison for Deep Array of Strings.
Lodash.isEqual vs JSON.stringify Equality Comparison for Plain Objects
Lodash.isEqual vs JSON.stringify Equality Comparison for Deep Array of Strings non-equals
Lodash.isEqual vs JSON.stringify Equality Comparison for Shallow Array of Strings. Testing 123
Comments
Confirm delete:
Do you really want to delete benchmark?