Performance: iJobComponentSystem using ECS vs Mono/Class

Ok, so I’ll attempt to make this as short as possible. I am making a traffic system using the data available from the asset “Easy Roads 3D” - The api from this asset gives me the roads and connection. Each of those objects has lanes, and each lane has a series of points along the path of the road. All fine and good.

Because of DOTS I can now have the number of cars in my scene that I want (Hover cars, so cars at multiple levels. …and yea I know MegaCity has this sort of things, I know how this looks, anyway)

Thing is, I need to access the road and connection info when EACH auto reaches the end of the current set of points. I am concerned that going to a Mono or just .net class to get this info each time the job runs would be a bit more expensive than if I recreate the road/connection/lane/points data as pure entity components. Recreating some of the functionality of the Easy Roads seems a bit silly, but I am GUESSING that using entities would be MUCH better to this process and the frame rates I require (VR game)

Thanks for any info.

Assuming that you are planning to use Burst to get a performance boost, keep in mind that Burst does not allow you to read data from MonoBehaviour instances. This will likely mean that you have to work around this. Here is how I would propose to tackle this:

  • implement the simplest solution first and profile it. This will likely mean not using Burst and accessing MonoBehaviours directly.
  • if it is too slow, switch to copying data from the relevant sources into a native data structure before running your bursted job.
  • if the data is needed all over the place and is mostly static, consider baking it into either Entities or blobs (preferably the latter).

Does that help?

1 Like

I am likely going to convert the data I need from Easy Roads into Entities to insure I get enough performance. Yea, that data will be static. Thanks for the info.