I modified Microsofts sample Entity Framework benchmark class to just look at the relative timing differences of tracking versus non tracking queries (eg. AsNoTracking).
The benchmarks are simple and just involve pulling back 1K, 5K and 10K records from a DB that’s populated prior to each batch of benchmarks (one for each record amount).
We can see from the results below that the cost of tracking entities relative to not tracking them goes up as we track more and more, this is to be expected. What did surprise me was the size of the differences.. for example AsNoTracking() is 3.56x faster than tracking when we are pulling back 5K entities.. which is a relatively small record set.
Note… when running benchmarks there can be so much variation between different machines and indeed different runs on the same machine. This means its important we look at the relative performance (eg. the Ratio column) of one benchmark compared to another and not focus too much on the absolute timings in the Mean column. Given we have a network latency aspect to the figures above this is even more important in this case.