0

I need a list from OldGuids that are not in the NewGuids, so I used the Contains method, the problem is that it is already running more then half hour, is there a faster way? or how much longer would it take about?

Dim OldGuids As New List(Of Guid) ' 18 million rows
Dim NewGuids As New List(Of Guid) ' 6 million rows
Dim Filtered = From n In OldGuids Where Not NewGuids.Contains(n)
Ash Burlaczenko
  • 24,778
  • 15
  • 68
  • 99
Ezi
  • 2,212
  • 8
  • 33
  • 60

2 Answers2

3

You should use HashSet<Guid>s.

You can then write OldGuids.IntersectWith(NewGuids)

SLaks
  • 868,454
  • 176
  • 1,908
  • 1,964
2
Filtered = OldGuids.Except(NewGuids)

(Note that this will only return unique elements, if you want to preserve duplicates this is not what you want).


var newGuidSet=new HashSet<Guid>(newGuids);
Filtered = OldGuids.Where(g=>!newGuidSet.Contains(g));
CodesInChaos
  • 106,488
  • 23
  • 218
  • 262