C# fastest intersection of 2 sets of sorted numbers

前端 未结 5 1427
傲寒
傲寒 2020-12-28 10:00

I\'m calculating intersection of 2 sets of sorted numbers in a time-critical part of my application. This calculation is the biggest bottleneck of the whole application so I

5条回答
  •  攒了一身酷
    2020-12-28 10:24

    try

    firstSet.InterSect (secondSet).ToList ()

    or

    firstSet.Join(secondSet, o => o, id => id, (o, id) => o)

提交回复
热议问题