jsondiff
jsondiff copied to clipboard
Comparing large JSON files
Hi and thanks for the great library. My use case is that I compare DOM trees that are represented as JSON files to find the difference between two similar webpages. Unfortunately, I have problems comparing two large JSON files (>300K) as the comparison never comes to an end (I stopped after 10 minutes).
I'm not sure whether this is due to a bug in the code and/or due to the complexity of the JSON files. While debugging a bit, I realized that many elements are compared multiple times with the same element (or also themselves). For instance the following element from diff1.json
when compared to diff2.json
(Example files).
diff1["childNodes"][0]["childNodes"][1]["childNodes"][29]["childNodes"][18]["childNodes"][0]["childNodes"][0]["childNodes"][1]["childNodes"][0]["childNodes"][1]["childNodes"][1]["childNodes"][0]["childNodes"][0]["childNodes"][2]["childNodes"][40]["childNodes"][0]
{'nodeName': '#text',
'nodeValue': 'Tienda Kindle',
'childNodes': [],
'attributes': {}}
Is there any option in the library to compare large JSONs or do you have any recommendation how to approach this use case? Thank you!