You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for(let i=0; i<a.length; ++i){
a[i] = {
"attribute 1": i,
"attribute 2": i,
"attribute 3": i
};
}
let b = JSON.parse(JSON.stringify(a));
b.unshift({
"a": 9999999
});
let start = new Date().getTime();
let diff = deepObjectDiff.detailedDiff(a,b);
let end = new Date().getTime();
console.log("Took " + (end - start) + " milliseconds.")`
For an array of size 10000, it can take 40+ seconds.
20000 = about 250 seconds
25000 = about 500 seconds
If the array is very large, 100000+ , it can take a really long time.
The text was updated successfully, but these errors were encountered:
What is the problem here? Bigger inputs take more time to process, and detailedDiff is the most expensive type of diff operation. Such an operation taking a while to process in JavaScript seems like expected behaviour.
Fair enough.
It does seem like a weakness in the algorithm though. 8+ minutes to process an array of 25000 simple objects seems like a bit much. I would expect such an operation to take maybe a minute max and not scale exponentially - then again I am not at all familiar with the internals of doing a detailed diff.
To reproduce:
`const deepObjectDiff = require("deep-object-diff");
let a = new Array(10000);
for(let i=0; i<a.length; ++i){
a[i] = {
"attribute 1": i,
"attribute 2": i,
"attribute 3": i
};
}
let b = JSON.parse(JSON.stringify(a));
b.unshift({
"a": 9999999
});
let start = new Date().getTime();
let diff = deepObjectDiff.detailedDiff(a,b);
let end = new Date().getTime();
console.log("Took " + (end - start) + " milliseconds.")`
For an array of size 10000, it can take 40+ seconds.
20000 = about 250 seconds
25000 = about 500 seconds
If the array is very large, 100000+ , it can take a really long time.
The text was updated successfully, but these errors were encountered: