I have a pretty standard block of code that compares two lists and returns the items from the first list that are not matched in the second list. (unmatched query)
But when both the lists are large-ish, the unmatched query takes 3 minutes to execute.
// names.Count ~ 91k
var names = xxxxx.ToList();
// namePhonetics.Count ~ 91k
var namePhonetics = yyyyy.ToList();
// this line takes 3 minutes to run
var namesMissingPhonetics = names.Where(n => !namePhonetics.Any(np => np.NameId == n.Id)).ToList();
What can I do to increase the performance of this?