while looking at this question C# Similarities of two arrays it was noted that the initial linq call was significantly slower than subsequent calls. What is being cached th
LINQ heavily uses deferred execution. Unless you enumerate a query, it does not get executed.
Change
s.Start();
z= a.Intersect(b);
s.Stop();
to
s.Start();
z= a.Intersect(b).**ToArray**();
s.Stop();
and please post the new performance results.
a.Intersect(b) represents an expression, independent of the value of a and b. Values of a and b are only used when the expression is evaluated by enumeration.