Using the same benchmark code I previously shared, these are new results on my personal windows 10 machine with a Ryzen 5600x (since upgraded from what I last posted)
Reminder: 64 systems each, Jobs Leak Detection off and JobsDebugger off, 10 entities
Unity 2020.1.17f1
0.11.1-preview.4
Monobehaviour (Pretend Entities) = 0.02ms
ForEachSystem = 1.97ms (1.58ms foreach)
ForEachAlwaysUpdate = 0.28ms (0.13ms foreach)
ForEachNoBurst = 1.93ms (1.80ms foreach)
0.17.0-preview.41
Monobehaviour (Pretend Entities) = 0.02ms
ForEachSystem = 1.20ms (1.04ms foreach)
ForEachAlwaysUpdateSystem = 0.29ms (0.14ms foreach)
ForEachNoBurstSystem = 2.03ms (1.89ms foreach)
Improvements are improvements! I won’t lie and not say I hoped for more out of box but it’s a step. The AlwaysUpdateSystem is unfortunately the best way to go still.
As for SystemBase… well… it took me hours to set it up the same way I use my traditional systems. Mainly because all the of extension methods needed for manual unmanaged world creation are flagged as internal! And there’s no exposed API in SystemBase I could find besides UnmanagedUpdate which is also flagged as internal, as well as ResolveSystemState as used in ComponentSystemGroup. So you cant even manually call Update() directly on these yet.
https://forum.unity.com/threads/world-extensions-for-unmanaged-systems-are-not-public.1043650/
and docs like this are empty
https://docs.unity3d.com/Packages/com.unity.entities@0.17/api/Unity.Entities.ISystemBase.html
Because I’m insane and reluctantly decided to spend more time on this, I forked it locally and modified the Entities package and made a few tweaks to expose all the methods I needed to grab the handles to the new systems and I manually resolve the state on my side, then call into the burst code, at the same point I do the previous tests. Results:
Jobs Leak Detection off and JobsDebugger off
Also I ignore the first warmup frames for this, JIT creates ALOT of GC Alloc in these the first time it hits.
ForEachSystem(NewIBase) = 0.19ms (0.18 ms job, entire systemstateresolve 0.21ms)
ForEachNoBurstSystem(NewIBase) = 0.29ms (0.27 ms job, entire systemstateresolve 0.31ms)
This is a real win if you’re willing to go the distance to fork 0.17 and expose everything, and the headache of figuring out the entry point to call the code like the actual SystemGroup would call it (ie calls Shouldrun to check entitiy queries)
Still, however, Monobehaviour wins this by a considerable amount. And Im sure these numbers spike on device, but I do not have the Pixel 2 anymore to compare.
It’s a great direction though. I will maybe revisit Entities in the future.