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
  • 23,106
  • 15
  • 65
  • 96
Ezi
  • 2,182
  • 8
  • 31
  • 60

2 Answers2

3

You should use HashSet<Guid>s.

You can then write OldGuids.IntersectWith(NewGuids)

SLaks
  • 837,282
  • 173
  • 1,862
  • 1,933
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
  • 103,479
  • 23
  • 206
  • 257