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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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.