As stated in the title, my program stutters like crazy, even though my program for the most part runs for 60 fps. During the moments it stutters, FPS momentarily drops down to 59(stats from FRAPS).
Here is an video capture of the stuttering in action. If you look closely, you can see the game stutter around 3-4 times. It is much more noticeable in real life.
http://gfycat.com/SevereCanineBabirusa
CLR Profiler shows that garbage collection doesn't run at all during that time, never mind 4 times, so it's not that.
Here's the code for movement:
//Movement logic
//Increase the speed
speed = Math.Min(speed + (speedIncrement * (gameTime.ElapsedGameTime.Milliseconds / 200.0f)), maxSpeed);
for (int i = fruits.Count - 1; i >= 0; i--)
{
//Move the fruits
fruits[i].pos.Y += speed * gameTime.ElapsedGameTime.Milliseconds;
fruits[i].rect.Y = (int)fruits[i].pos.Y;
//Check if the fruit is past the screen. If it is, remove it from fruits
if (fruits[i].rect.Y > screenHeight)
{
fruits.Remove(fruits[i]);
}
}
IsFixedTimeStep is set to false, but SyncronizeWithVerticalTrace is on. Any idea what could be the cause of the stuttering?
EDIT: Apparently it was a combination of this: http://answers.microsoft.com/en-us/windows/forum/windows_7-performance/presentationfontcacheexe-uses-50-of-my-cpu/4200fe85-458f-4f19-b791-1fe5395304da and f.lux eating up my CPU/GPU cycles.