I have 2 very large sets of data that, due to the limitations of my environment, I need to compare in the client side.
The size of the corresponding Array of objects are over 450k each, I have been testing different ways to compare them (For loops, .find, .indexOf, .reduce, $.grep) and all of them are running very slow (Around 700 calculations per minute).
The check consists to find out if each of the objects in one of the array is already included in the other one such as:
var Arr1 = [{ID:2, Name: Bar}, {ID:1, Name: Foo}]
var Arr2 = [{ID:2, Name: Fu}, {ID:2, Name: Bar}]
If any of the objects in Arr2 is included in the first one by any property, in this case (Arr2[1].Name == Arr1[0].Name)? would return true
And in that case I would push it to a new Array of objects we can name Found: Found.push(Arr1[0])
I of course need to perform this check for all the 400k+ objects in my array so it gets pretty slow.
I know there are several "buts" in my request, such as available RAM and Processor speed but assuming the perfect environment, what would be the fastest way?