Search Unity

Meshskinning update spikes

Discussion in 'Web' started by diekeure, Nov 19, 2015.

  1. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    221
    Hello,

    I started profiling our webgl game and I notice these spikes:



    The "PutGeometryJobFence" call spikes every few seconds taking more than 50% of the frame. I have only one character with skinned meshes in the scene.

    Is there a way we can avoid this? Make it less frequent, optimize things?

    Thanks,
    Alex
     
  2. Marco-Trivellato

    Marco-Trivellato

    Unity Technologies

    Joined:
    Jul 9, 2013
    Posts:
    1,654
    That seems odd. Is it a complex character ? how much does PutGeometryJobFence cost in frames with no spike ?

    You could try to reduce the number of Blend Weights to 2 or 1 bones in the Quality Settings.
     
  3. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    221
    I analyzed a bit more, screen shot here:



    The first half you can see there are no spikes, Meshskinning.update takes at most 2%, the second half there are spikes, where it takes 50%

    The difference is this: in the first half I had my browser window on my secondary, smaller (resolution wise) monitor, in the second half it's on the primary larger monitor. Because it's a bit larger, there are 30 more drawcalls but I don't think that has anything to do with it.
     
  4. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    221
    I tried setting the blend weights to 1, no difference.
     
  5. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    Could you file a bug report with a small repro case for this (and post the case number here)? This looks like something we should investigate in depth.
     
  6. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    221
    I filed a bugreport, with this number: 746290

    Basically it's just the character model with the animator from the game, and a small piece of the code that replicates the behaviour we have in game. The result is the same: when the animator changes states we see high spikes.

    Many thanks for your help!
     
  7. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    221
    Not unimportant: I just confirmed with the bug report project that you see these spikes *only* if the browser is on a secondary screen.
    So this happens on my laptop, and when I run the game on the screen of the laptop -> spikes, if it's on a secondary screen then there are no spikes (or less big).
    In my second test the resolution of both screens is the same and I see the same behaviour so as I expected: resolution is not important here.
     
  8. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    Just upgraded to 5.3.0f4 today.

    At first glance in the editor things looked good, but once we built to devices and profiled we noticed the same issue "PutGeometryJobFence" causing a major cpu hit. It seems pretty constant during our gameplay. For us this was not a problem in 5.2.3. Here is a shot from our profiler: Profiler.PNG

    Our project is a 2D game, and it seems the issue appears when our character sprites are present (which is almost always).
     
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Please report bugs as these things will definitely get missed.
     
  10. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    I have filed a bug, Case 751895 regarding the PutGeometryJobFence sustained performance hit. I'll be continuing experiments today to try to identify more accurate what is causing this increase.
     
    hippocoder likes this.
  11. TitanUnity

    TitanUnity

    Joined:
    May 15, 2014
    Posts:
    180
    I received a response from Unity QA and was able to submit a reproduction project, we'll see what they say. For now I'll copy you all on my most recent message to Unity:


    I was able to isolate the assets that cause this new sustained performance problem for us. Maybe you can help us figure out why this occurs.

    I've attached 2 screenshots and a simple project extracted from our game. In the scene of the sample project I've added one of our game map backgrounds that is now performing poorly. To be clear, all of our maps were previously optimized and ran smooth in both 5.1.4 and in 5.2.3...

    In fact, the performance was so well optimized we wrote about it on our blog back in October:
    http://biobeasts.artix.com/2d-background-performance-in-unity/

    Now that we've upgraded to 5.3, we see what appears to be normal looking performance when profiling from the Editor (below):


    However, when the exact same project is built to an Android device we see terrible performance (below):


    We saw this poor performance on several devices, including: Droid Maxx, Samsung S6, and Nexus 7 tablet.
    The simple project is attached, please keep me updated:
    https://drive.google.com/file/d/0BwL7QqsvL2_EaWhvd1Y1MFlDeU0/view?usp=sharing
     
  12. diekeure

    diekeure

    Joined:
    Jan 25, 2013
    Posts:
    221
    I'm not entirely sure you should post your problem in this thread, as this is in the WebGL forum and not the Android one.
     
    Dantus likes this.
  13. roka

    roka

    Joined:
    Sep 12, 2010
    Posts:
    598
    Last edited: Dec 10, 2015