measuring code perfomance of queries, what to think of the result?
<p>I have some code that looks like this:</p>

<pre><code>    public void SomeMethodThatLoadsUserData()
    {
       Stopwatch sw = new Stopwatch();
       sw.Start();

       Parallel.Invoke(Method1, Method2, .... , Method12);

       sw.Stop();
       var t = sw.ElapsedMilliseconds;
}
</code></pre>

<p>Each of these methods end up calling a query in the database. When I hit the Debug button, the first time this code runs it takes about 1200ms. And then, when I hit the restart button, after about 10 times, the result averages around 220ms.</p>

<p><strong>Is this huge gap due to the fact that A</strong>) the first time the application must do some sort of compilation and the actual result on a production environment will be closer to the 220ms average I'm getting on my laptop <strong>or B</strong>) the data is cached in SQL server and when I hit the restart the data is read from cache and therefore the real performance of the method on a production environment will actually be closer to the 1200ms I see on the first run.</p>

<p>Thanks for your suggestion on how to read these figures.</p>
