Search Unity

How improve jobs performace

Discussion in 'Entity Component System' started by dreamerflyer, Jan 21, 2018.

  1. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Without mono on the editor side, you have huge iterative workflow problems (way too slow compile times) and error checking becomes really hard.

    There are technical justifications though, you can't use burst and you have to copy memory back and forth without NA. I'd call them technical justifications that are 100% optional - you can always do your own threading, still.
     
  2. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    We don't know that you will be able to do that, would be interesting to hear if we can, or if the new api's that allow concurrency will only be available when in a job context.

    Things like the burst compiler is actually a good example of something that is not a technical justification. There are a lot of use cases where you wouldn't care about that. Just because others haven't thought of those doesn't mean they are not there. And that is exactly the trap MS got itself into. It's why for example we can't tune the .NET GC for low latency workloads very well, because while internally it's possible they restrict access to the tuning knobs needed, because they never thought it would be useful.

    None of this is stuff people like myself can't work around. But this is the time to pick on design, so I'm picking.
     
  3. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    With the focus on bust, it sounds like Unity is moving towards longer build time.
    I'm a fan of quick iteration cycles.
     
  4. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    So am I. Our aim is to reduce iteration time. With burst we can do lots of caching on a per job basis, if none of the code in a single job has changed we can cache the compiled code.

    Overall we want iteration times to be reduced, starting with C# script compilation time, that is one of our focus areas right now.

    The burst compiler itself in the editor is running async, meaning we run the C# code via mono until the burst compilation completes at which point we hot swap the compiled burst job function in.
     
  5. Filtiarn_

    Filtiarn_

    Joined:
    Jan 24, 2013
    Posts:
    173
    Really good performance!!! I get 360+ fps using the Lightweight rendering pipeline. I have a i5 Surface pro 4 so I don't even have a graphics card.
     
    MadeFromPolygons likes this.
  6. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    Brilliant! But that hot swap... do we get the typical post compile hiccup again?
     
    Last edited: Jan 28, 2018
  7. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    Replacing a function pointer is like a hook.

    The hiccups you are talking about are related to unity serializing everything, not actual code compiling or reloading.
     
  8. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,364
    oh so background burst compile is followed by that function pointer swap? no hiccup is good.
     
  9. John_Leorid

    John_Leorid

    Joined:
    Nov 5, 2012
    Posts:
    651
    I schedule about 1500 jobs in a single frame and this results in a lag because of the jobDebugger - if you schedule one job each frame and jobDebugger is enabled, this could maybe cause reduced framerates too. Unity keeps enabling the JobDebugger each time Unity is started, so I wrote this small script:


    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class DisableJobDebuggerOnAwake : MonoBehaviour
    4. {
    5.     void Awake()
    6.     {
    7.         Unity.Jobs.LowLevel.Unsafe.JobsUtility.JobDebuggerEnabled = false;
    8.     }
    9. }
    I haven't read the whole thread because actually I just wanted to see if there is any better way to profile unity jobs than using the .Net stopwach, still - maybe this code-snippet is useful for someone. ^^
     
    mitaywalle likes this.
  10. runner78

    runner78

    Joined:
    Mar 14, 2015
    Posts:
    792
    You can disable JobDebugger also in the Jobs menu.