Imaging you have 3 lists/arrays in javascript/NodeJs
- array contains 1.000.000 data-items
- array contains 100.000 data-items
- array contains 50.000 data-items
Each data-item is a object with 2 properties - Like a date and a price. All items in array 2 and 3 are subsets/sub-list of items from array 1.
My question: How do i in the fastest way - match all dates of each item from array 1 - with all the dates in array 2 and 3 - for each single item in array 1?
I'm used to .NET/C# - where something like 'contains(item)' is nice... right now in NodeJS i use 3 for-loops - which is way to slow...i need some kind of index or the like to speed up the process...
An example of data could be like:
Input:
array 1: 1,2,3,4,5,6,7,8,10
array 2: 2,3,5,7,9
array 3: 1,4,5,10
Out-put (written to a file):
1,'',1
2,2,''
3,3,''
4,'',4
..ect...