Search Unity

RaycastCommand.ScheduleBatch minCommandsPerJob

Discussion in 'Physics' started by koirat, Sep 23, 2018.

  1. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    So what is exactly minCommandsPerJob in RaycastCommand.ScheduleBatch.

    And most important what is the sane number you can use as minCommandsPerJob on PC platform.
     
    Claytonious and Abbrew like this.
  2. Abbrew

    Abbrew

    Joined:
    Jan 1, 2018
    Posts:
    417
    Wild guess but this may be related to innerLoopBatchCount, where you would start at 1 and increment it in powers of two until the performance boost stops growing. Is this correct?
     
  3. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    I was thinking that maybe this number specify min commands the thread is going to be created for, so if you got less commands it is going to be performed in a main thread not in a new one.
     
  4. sirleto

    sirleto

    Joined:
    Sep 9, 2019
    Posts:
    146
    i wondered the same thing, couldnt find any documentation for it today (3 years later).

    i would guess that this value is somewhat related in how to parallelize the work?
    e.g. if you add a total of 100 rays to cast, and you put minCommandsPerJob at 100 then it will be done async (from POV of the main thread) but only in 1 thread worker.

    if you have a total of 100 and put minCommandsPerJob at 10, then it will run 10 workers parallel - which only makes sense if your CPU has atleast 4 cores + hyper threading, so it can actually parallelize 10 workers more or less reasonably.

    if you have a total of 100 and put minCommandsPerJob at 20, then running it on a dual core mobile phone will not speed it up more than having minCommandsPerJob at 100 (for this certain hardware).

    could this be correct?