Debugging performance issues Gfx.WaitForPresent

For some reason my application has gone suddenly from 50-60fps to 8fps and the CPU is running at over 90%.
Puzzled I tried commenting out any updtes or cpu intensive calls but no difference.
Looking at the profiler I see one consistent process running at over 80% total with a time of 90ms.

Does anyone know what this might indicate?

Gfx.WaitForPresent

After some googling discovered this is a common problem on Windows and has something to do with the way Direct X is implemented. Forcing OpenGL on windows causes the problem to go away but I also tried switching the order of the Graphics API for Windows setting in
Project Settings > Player > Other Settings
Making Direct3D11 first cuases the problem, while if I use Direct3D9 first, the problem also goes away. So the culprit seems to be Direct3D11, anyone know why?

After some googling discovered this is a common problem on Windows and has something to do with the way Direct X is implemented. Forcing OpenGL on windows causes the problem to go away but I also tried switching the order of the Graphics API for Windows setting in

Project Settings > Player > Other Settings

Making Direct3D11 first cuases the problem, while if I use Direct3D9 first, the problem also goes away.
So the culprit seems to be Direct3D11, anyone know why?

It’s not related to v-sync; this is a very common misconception however. While disabling v-sync will most likely improve your FPS, this is unrelated to the real cause, but only because v-sync reduces FPS in and of itself. Gfx.WaitFoPresent means that the CPU is waiting for the GPU to finish - i.e. he is waiting for the GPU to present the visuals. You will have to reduce the quality of stuff that is being rendered by the GPU. Shadows would be a good place to start, as well has very high resolution textures and meshes. You should also optimize your meshes so they share materials whereever possible, for instance.

Matt talks about Gfx.WaitForPresent in this live training. (15:20)

It’s related to v-syncing, if I recall correctly. Try turning off the frame limiter (in Player settings, I think?) and let it render whenever it’s ready, and you should see a good boost.

^ Incorrect. See Thomas’s response below.