Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Android: Help me understand various weird performance spikes

Discussion in 'Editor & General Support' started by eliphat, Jun 12, 2022.

  1. eliphat


    Jul 4, 2017
    My game is developed with Unity 2021.3.1f1c1. I'm meeting random performance spikes through game play. I have tried my best to reduce any overhead in the script, and reduced overdraw and draw calls by a lot. The performance is much better than before, but there are still weird spikes. Currently overdraw is less than 3x and there are around 40 batches with about 1k vertices and triangles. Scripting time is less than 2ms.
    I turned multi-threading rendering on and off, and nothing seems to ever change.

    Profiling results:
    Device 1, Graphics Jobs Off/On: AcquireNextFrame spike. It usually costs about 0.3ms, but can go up to 30ms occassionally, bleeding through the 16ms line for 60fps. These frames have nothing special -- no large objects generating, not any interesting or new stuff going on compared with other frames.
    Device 2, Graphics Jobs On: Main thread waiting for a Canvas.SortJob. The Sort only costs 0.02ms on the job thread, but the job somehow continues for up to 30ms. Actually, it is quite weird to me because this happens even on a scene only with static canvases.

    What are these methods doing under the hood? Please help, and thanks in advance!