03-08-2018, 09:32 PM
(03-08-2018, 03:45 PM)josemendez Wrote: Hi there,
Obi already uses something very similar to ECS internally, as it was designed with the same performance goals in mind:
- Particles are laid out in memory in a SoA fashion: separate arrays for positions, velocities, etc. Traversal is linear when possible, to maximize cache hits and throughput. These arrays are 16-byte aligned to make use of SIMD (SSE) instructions. This is the same core idea behind ECS. It is not something new, CPU particle systems have been designed this way for as long as the concept of cache memory exists.
- A work-stealing job scheduler dynamically distributes jobs across all cores. Jobs (tasks, in Obi terminology) are organized in a graph-like structure to avoid race conditions and make sure things happens in the order they're supposed to. This is the same technology behind Intel's TBB, Cilk, or C#'s TPL, again nothing new.
Moreover, all of this is written in C/C++ using SIMD, hand-optimized. The burst compiler is basically designed to translate C# code to efficient, vector-friendly C++ code, which is what we have by default.
Because of this, no gains are to be reaped from ECS or burst in our case. It is very unlikely we will make use of them.
Sounds indeed like it wouldn't help at all except giving us near the same kind of performance while having access to the whole code.
However wouldn't porting to c# and optimising this way also give instant Playstation/Xbox compatibility?