2021年4月7日星期三

Filter large arrays using node js

I have 2 large arrays populated with strings both containing > 150.000 elements

const allNew = allArrayOneValues.filter(val => !allArrayTwoValues.includes(val));  

I need to compare the two arrays like this to find out which elements are not in ArrayTwo yet or to find out which elements to delete from ArrayTwo as they are no longer in ArrayOne.

Filtering here takes around 3 to 5 minutes... is there a way to do a far more efficient compared to find out which values in ArrayOne are not yet in ArrayTwo OR which values are in ArrayTwo which are not in ArrayOne...

Thanks Thomas

https://stackoverflow.com/questions/66982304/filter-large-arrays-using-node-js April 07, 2021 at 04:30PM

没有评论:

发表评论