Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

[Jobs,PhysX] Spike and CPU usage

Discussion in '2018.1 Beta' started by dyox, Jan 17, 2018.

  1. dyox

    dyox

    Joined:
    Aug 19, 2011
    Posts:
    619
    Hello,

    I'm experiencing 2 problems on Unity 2018.1b2 with Jobs and Physx.

    -PhysX create many spikes and lags. The scene contains only one FPSController :

    ColliderSpike.jpg


    I think it's related to my second problem using Unity.Jobs.

    Code (CSharp):
    1.         public struct ParrallelGenerateJob : Unity.Jobs.IJobParallelFor
    2.         {
    3.          
    4.             public void Execute(int ChunkIndex)
    5.             {
    6. DoStuff(); // <----- This function take 20ms maximum
    7.             }
    8. }
    9. ParrallelGenerateJob Job = new ParrallelGenerateJob();
    10. GenerateHandle = Job.Schedule(1024 1);
    11.  
    12.  
    Actually, jobs are executed all in row without switching to other jobs, and create freeze and lags on CPU.
    Maybe because other unity systems can(t process. Here is the result :

    JobsSpike.jpg

    Also, sometimes it happens (on editor) that a job is executed on the main thread, and i have a timeline showing ParrallelGenerateJob 1000ms on "Main Thread";

    Am i using Jobs correctly or it is a bug that everything is executed in one row without zero chance for other jobs to be executed.

    If i use only IJobs, this problem do not appear and jobs are correctly dispatched between other unity jobs.

    Thanks.
     
  2. Enrico-Monese

    Enrico-Monese

    Joined:
    Dec 18, 2015
    Posts:
    77
    I have also experienced the big spikes for Physx. Only thing in the scene is a character controller though. And my jobs take nowhere near that long.
     
    dyox likes this.
  3. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,619
    I reported this issue a while ago as:
    (Case 983582) 2018.1: Physics.Processing performance issues
    Unity QA was able to reproduce, here is their reply:
    For whatever reason, the issue does not seem to exist in the public issue tracker yet.
     
    dyox likes this.
  4. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,136
    That's a bug. Will hopefully be fixed soon, together with the missing 2018.1 (Beta) category...

    As for the physics bug: it's on the radar, but will probably not be addressed until February. I'll reply with the issuetracker link as soon as I get wind of it.
     
    PhilSA, LennartJohansen and Peter77 like this.