2
我試圖在linq查詢之前使用秒錶,並在LINQ查詢之後停止它,但linq查詢需要2分鐘,但stopwtach結果給出40 MS的時間!如何測量LINQ Query的時間?
這是LINQ查詢
Stopwatch stopwatch = Stopwatch.StartNew();
var sets =
from a in patient
from b in patient
from c in patient
from d in patient
from l in patient
where a.VisitNum < b.VisitNum && b.VisitNum < c.VisitNum && c.VisitNum < d.VisitNum && d.VisitNum < l.VisitNum
select new { a, b, c, d, l };
stopwatch.Stop();
什麼建議嗎?
難道很多的LINQ to SQL實現嵌入'.Count之間()'插入到SQL調用中,這意味着您的性能猜測會顯着受到影響,因爲您不必花費時間通過網絡發送對象。 – Guvante
@Guvante:不適用於LINQ to objects。 – SLaks