Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Should I convert single/simple operations into jobs?

Discussion in 'Entity Component System' started by MagicianArtemka, Dec 23, 2020.

  1. MagicianArtemka


    Jan 15, 2019
    Hi guys,

    I have the next question: for example, I have the next pseudocode:

    Code (CSharp):
    1. func DoSomeCode()
    2. {
    3.     DoFirstAction();
    4.     DoSecondAction();
    5.     DoThirdAction();    //This function contains code, that cannot be done in a job.
    6.     DoFourthAction();
    7. }

    Question - What should I do to get more performance: convert First, Third, and Fourth functions into jobs OR reimplement my code to make it all work in the job and create one job DoSomeCodeJob?

    Let's suggest, that functions First, Second, Third and Fourth have "middle" complexity code.
  2. DreamingImLatios


    Jun 3, 2017
    Don't optimize prematurely. Focus on your bottlenecks first.
    MagicianArtemka likes this.