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.
  2. Dismiss Notice

Question RenderMeshSystemV2 taking a lot of time

Discussion in 'Graphics for ECS' started by kartik_unity, Dec 24, 2020.

  1. kartik_unity

    kartik_unity

    Joined:
    Jan 14, 2020
    Posts:
    4
    tl;dr: Getting a bottleneck in ECS, according to profiler: "RenderMeshSystemV2" when drawing 3000 boids (made of a simple quad) on Unity 2019.4.14

    Hey, new to ECS here (started a tutorial 2 days ago, still wrapping my head around it) and I am testing my own "boids stress test" project to push this system to its limits. I think I've got the jobs system working as expected because all the worker jobs are pretty active, and my boids algorithm is taking the least amount of time in the profiler.
    Screen Shot 2020-12-24 at 3.41.50 PM.png

    That being said, the part that is taking a lot of time is "RenderMeshSystemV2". At the time of taking this screenshot, there were 3000 boids on screen, so it is not surprising that it would struggle a bit. I was surprised that rendering was the bottleneck however. See the profiler hierarchy below:
    Screen Shot 2020-12-24 at 3.41.35 PM.png

    Is this something that can be optimized at all? Or due to hitting a bottleneck in rendering, am I at the limit of what my PC is able to do? 3000 boids seems low, I was imagining being able to hit a much higher number.
     
  2. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,626
    This is miss leading. The reason the RenderMeshSystem is taking so long is it's simply waiting (Job.Complete) on the previously scheduled jobs from other systems (BoidSystem) which you can clearly see in your timeline screenshot.

    Your BoidSystem is extremely slow, taking 30ms+, not RenderMeshSystem.
     
  3. kartik_unity

    kartik_unity

    Joined:
    Jan 14, 2020
    Posts:
    4
    Ah I see. Should I edit the title of this post or something?

    I did see the "JobHandle.Complete" but I assumed that was Unity completing some rendering related job. If it is my boids system taking a long amount of time, why am I not able to see what part of the system is unoptimized? Even with deep profile I am not able to see any particular part of my boids system that is taking a long time. Any ideas on how to find what is taking so long?
     
  4. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,626
    Your first lambda job is taking all the time. You can use Profile Markers
    https://docs.unity3d.com/ScriptReference/Unity.Profiling.ProfilerMarker.html
    To profile burst jobs.
     
  5. kartik_unity

    kartik_unity

    Joined:
    Jan 14, 2020
    Posts:
    4