What does ScheduleTimeInitialize do?

Hey all!

I’m currently stress-testing my simulation with 100 or 1000 updates to the systems in a single update.

Does anyone know what ScheduleTimeInitialize does?
I’ve found the implementation of it and I think it’s scheduling the job and data but I don’t understand why the timings are so high.
Currently this is a bottleneck where I’m not sure how to proceed or if that’s just the way it is.

Okay the Dots Compiler made it clearer what’s going on. ScheduleTimeInitialize gathers the required chunk data.

What I’m not sure now is, are the timings that high because of ENABLE_UNITY_COLLECTIONS_CHECKS? And how can I find out if that’s the case?

Are you profiling in a build or in the editor?

Oh right …
I’ve since tested in a build and timings are still that high. How can I get these timings lower? The IComponentDatas in the StatsSystem are huge, no doubt about that. I’m using 5 stat components with 96 bytes each.

As I’m testing right now I’m even finding out that SystemBase is slower than ComponentSystem.

What’s going on here?

I just changed a problematic, slow and really light-weight system from SystemBase to ComponentSystem and getting 20ms instead of 60ms when measuring. I’m using the slowest form there is, EntityManager.GetComponent in main thread.
(Note: In this case I’m updating 3600 times per update, so 1 minute. That’s why these numbers are that high)

Whatever is going on in this ScheduleTimeInitialize and data acquisition is killing performance.

What I can say is that SystemBase doesn’t like to be called more than once per frame.

edit: more testing

SystemBase with ECB and Schedule is in the 50-60ms range
SystemBase without ECB and Run is in the 14-16ms range.

That’s perplexing to see when the ECB solution has additional load on the ECB system.

More measurements as I’m rewriting systems and testing which perform better.

I rewrote my AttackSequenceSystem and did the same as with other systems. I used Run(), avoided Has/Set/GetComponent from SystemBase as this was codegen-ing GetComponentDataFromEntity and use the main threaded EntityManager.Set/Get/HasComponent instead.

I did this with a few systems now, 4-5 and my timings when simulating a full minute went down from 1000ms to currently 284ms and I can bring it down even further because I still use this broken Schedule and codegen-ing in a few systems.

As I don’t have any response yet. PLEASE take a look at this. I’m honestly wondering why not more are talking about this.
I just heard a few souls on Discord about it.

It’s a high priority focus atm I believe:
https://discussions.unity.com/t/787739/7