Skip to content

Comparing large arrays can take forever #56

Open
@Kagan-Of-Sky

Description

@Kagan-Of-Sky

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions