Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Sudden Performance Issue - Profiler shows repeating spike...

Discussion in 'Editor & General Support' started by Gibbonuk, Jan 16, 2017.

  1. Gibbonuk

    Gibbonuk

    Joined:
    Dec 10, 2013
    Posts:
    175
    Hi, since Friday when i was last working on my project and recorded a in-editor video using fraps (which was nice a smooth) I have this morning come against a sudden performance hit that occurs every second?

    You can see the spike on the profiler, and it is also very noticeable when in-game. If I walk, every second (or so) it will do a small pause and then continue...

    I have tried re-tracing steps and simply clicking things on and off in game to try and find out why but cant really get to the bottom of it, the only time it is "not there" is when the game is loading and simply has a GUI window infront of everything showing a loading bar, after which it then spawns a character controller and thats when it starts. I have tried disabling the character controller though and it continues....

    I know it must be hard for you lot to "guess" but any idea what could be causing the repeating spike? OR point me in the direction to where i can start trying to find it?

    As you can see from the image, its the gfx.waitforpresent and profiler.finalizeandsendframe that are what seem to spike, but from what I have read these are caused from other things?

    I also have Vsync off, and what I have noticed is even with graphics on low, i still get them?

    EDIT: Just to add after some more testing... It sometimes seems to get worse the longer im in, it certainly almost always starts smooth and then gets worse. But also I can sometimes be in areas where the FPS is showing 200+ but the "stop start" is still happening?? It seems the FPS goes from 200 to 100 when doing its stupid "pause"?

    EDIT 2: One more thing I have noticed is if i pause the editor and give it a few mins, when i play again its smooth for a short while then comes back...however, if i pause and play within a few seconds it remains right away... I just dont understand...

    Thanks
     

    Attached Files:

    Last edited: Jan 16, 2017
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,562
    1. Does this happen also when you run without the profiler ?
    2. Did you try profiling without "deep profiling" enabled ?
     
  3. Gibbonuk

    Gibbonuk

    Joined:
    Dec 10, 2013
    Posts:
    175
    1. Well, it did which is what made me open the profiler and start looking, however I read and notied the extra overhead the profiler puts on when run in the editor.
    2. Yes i turned this on to try and look deeper into what can be causing it.

    Last nite I managed to get a significant improvement by setting the vSync to every second V blank? Im not sure if that helps in working out what could be causing this?

    Just to add, im using unity 5.5.03f, windows 7.

    Thanks
     
    Last edited: Jan 17, 2017
  4. jpflores

    jpflores

    Joined:
    Sep 29, 2016
    Posts:
    4
    I'm having a similar problem. I'm making a runner game with a linear movement and I need a really smooth movement therefore vsync is a requirement. But every second I'm losing a frame. If I siwtch off the vsync I have an important tearing issue.
    May it be a problem caused by an old GPU or a bad screen?
     
  5. MikeSz

    MikeSz

    Joined:
    Jul 7, 2014
    Posts:
    31
    It's even worse for me. I had zero performance issues with my project for past few months

    Today I changed from 5.4.2 to 5.4.4p1 and 5.5p4 - in both latter version I saw MASSIVE performance issues. Launched the profiler and...



    Script and rendering times are pretty constant...


    But the profiler calls are out of this world


    All from iPad, didn't change anything in project settings since previously working builds

    Tried to restart the device, my Mac - nothing helped
     
  6. Gibbonuk

    Gibbonuk

    Joined:
    Dec 10, 2013
    Posts:
    175
    I am bringing this back up,as since posting this i have spent hours and hours trying to optimize scripts and trying everything I can to find out what is doing this but nothing seems to help.

    Attached is a new screenshot showing the profiler again.

    This is run in the editor (I have tried running it as a build too, no luck) and as allways the game starts fine, super smooth steady FPS and all is fine, about the same time every time time (about 3-4 minutes in) I start getting noticeable "pauses" and the FPS start to dip a bit. It gradually gets worse but reaches a plateau where I get the lags around every second.

    Ive tried disabling a lot of the graphic stuff (which isnt a lot) and the FPs can go upto 200+ but the lag/pauses/stutter remain the same??

    The only thing i can see in the profiler is that the garbage collector coincides with these spikes but I dont think there causing them?

    If I pause the game in the editor, leave it a minute and then carry on, its smooth for a short while and then goes back to the stutter.

    This also happens when i build and run, just as above.

    Anyone else recommend anything to try?
    prolfer-3.png


    Thanks
     
    Last edited: Jan 20, 2017