- Home /
VSync Decreases Performances?
This is the situation,when I am running my game with Fantastic quality setting and making the V Sync Count Every V blank,the game seem to run fine,I changed it to Every second V Blank,The game all of sudden seem to run slow, Then I changed it to no Vsync at all then the game ran very fast.I Checked the profiler and found out that VSync Is taking up the majority of the CPU Usuage.I want to know how VSync works and what they do.
Answer by Dave-Carlile · Jun 26, 2015 at 02:07 AM
Vertical Sync synchronizes the frame display with the monitor refresh rate. This prevents the "tearing" effect that happens when the game updates a frame in the middle of a screen refresh, and generally makes things run more smoothly.
Syncing isn't hurting your performance. You aren't using up the entire time you have available to build the next frame, so your code ends, and then Unity waits for the vertical sync to display it.
Think of it like this. Frank and Bob are both working on something, but once every minute they have to push a red button. Neither can continue doing their job until both have pressed the red button each minute. Frank always finishes his task in 20 seconds and pushes the red button. But Bob always takes the full minute to do his work before pressing the red button.
So each minute, Frank has to wait 40 seconds, idling, doing nothing, until Bob presses the button. Then they both continue on.
Frank is the CPU, Bob is the GPU/V Sync. The CPU gets its work done for the frame and is ready to go, but it must wait for the GPU to "push the red button" before it can continue on and start working on the next frame.
The CPU Usuage of the vSync is taking up alot of the usuage how can I reduce it?
You don't, or you turn off vsync. The reason it 'uses' lots of CPU is because the cpu has to wait for the GPU.
Exactly - that CPU is still available to your game if you add more functionality that requires it, in which case Unity won't have to wait as long for the vertical sync.
Think of it like this. Frank and Bob are both working on something, but once every $$anonymous$$ute they have to push a red button. Neither can continue doing their job until both have pressed the red button each $$anonymous$$ute. Frank always finishes his task in 20 seconds and pushes the red button. But Bob always takes the full $$anonymous$$ute to do his work before pressing the red button.
So each $$anonymous$$ute, Frank has to wait 40 seconds, idling, doing nothing, until Bob presses the button. Then they both continue on.
Frank is the CPU, Bob is the GPU/V Sync. The CPU gets its work done for the frame and is ready to go, but it must wait for the GPU to "push the red button" before it can continue on and start working on the next frame.
+1
- excellent.
PS: you should add your comment to the answer. It's the best explenation I've read in a long time.
So of the cpu have to wait for the gpu..does it mean that my gpu sucks? I have the same issue.. no v sync 500 fps.. with v sync 80.. every second 30 fps.
Not necessarily, it's your monitor the one that refreshes. If your monitor's refresh rate is 60Hz, then if your game would run at more than 60 fps (say, 85 fps) you would have to wait for your monitor, not the gpu
Answer by MisterKidX · Jan 01, 2019 at 08:25 AM
Just wanted to shed more light on this matter, concerning the profiler.
When Quality Settings > V Sync Count is set to an option that is not "Don't Sync" (Or by code, see reference) Unity will match frame rate to your monitors' refresh rate (depending on the value you have given Vsync). What you see in the profiler under CPU Usage > Vsync is the time unity waits before rendering another frame. This can be foundin the hierarchy view of the profiler as Initialization.PlayerUpdateTime > WaitForTargetFPS. What this means, basically, that this value is actually positive as it grows larger in percentage.
Note that you will not see valid value if the option of Vsync is turned off from the Quality Settings menu.
https://docs.unity3d.com/Manual/ProfilerWindow.html https://docs.unity3d.com/ScriptReference/Application-targetFrameRate.html
Thanks for your help, I turned off vsync, then I used Application.targetFrameRate to limit the fps.
Your answer
![](https://koobas.hobune.stream/wayback/20220613201416im_/https://answers.unity.com/themes/thub/images/avi.jpg)