When using prediction system, it’s extremely costly for each system especially at mobile platform. The highest time spent at android I observed can reach until around 0.35ms+ for just only 1 system. The only work that the system does is just schedule IJobEntity or go through idomatic foreach and nothing more.
The solution is to make it only schedule job once / run idiomatic foreach query once during prediction system update to minimize the time spent significantly. I checked profiler one system around 0.035ms+ when run only once but since prediction system will run multiple times, it will eventually become to like around 0.35ms+. After this optimization, I believe it can lower down 0.035ms+ or even lower per system which is really fast.
For example: Let say the system run 10 times during prediction, one system do job scheduling / idiomatic foreach spends 0.35ms (0.035ms x 10). After the optimization, job scheduling / idiomatic foreach will run only once and now only spends 0.035ms which is 10x improvement. So if u have 10 system which is 100x improvement. Basically the idea is similar to build physics bounding volume hierarchy only once.
This is not really the same. If you can do “incremental” changes on top of that single update that is fine. But if you run a system only once, that system should be designed for that specifically. Otherwise you may (and will do) mis-predict a lot or not simulate things as expected.
So yes, you can do it, but there should be a specific design around it. Can’t be a generic implementation suggestion.
Oh I think u misunderstand I say. What I actually mean is the system still run multiple time at prediction but we do some kind of caching to make it schedule job / idomatic foreach query only once. The bottleneck here I believe is job scheduling and entity query takes a lot of time on main thread. So we cache it to reduce that time spent significantly but the system still run multiple times just exactly like before. I guess this require to change the core of Entities and job system significantly to enable it?