When I did benchmark my code I noticed that the first run is too slow and the next runs are too fast. what is the reason?
for (int i = 0; i < 10; i++)
{
var timer = new Stopwatch();
timer.Start();
var expression = new Expression('x');
Console.WriteLine(timer.ElapsedTicks);
}
And the results
15096
6
0
1
1
1
1
1
0
Is there any way to always get the maximum speed even at first run?