Add feature/native
- An arch variant only using native memory
#141
Labels
feature/native
- An arch variant only using native memory
#141
Problem
Arch itself uses managed arrays. There's no way around it, this way it can support managed and unmanaged components.
However, not anyone needs managed arrays since they create additional GC pressure.
The hybrid
feature/unsafe
variant exists to combine unmanaged and managed memory efficiently. However, it is rarely used and is a bit slower than the master. Unfortunatelyfeature/unsafe
can not provide a clean way to split between native and managed arrays and therefore it causes a lot of branching during queries or lookups (since it is always forced to check whether it's a managed or unmanaged array that is being accessed: https://github.com/genaray/Arch/blob/feature/unsafe/src/Arch/Core/Chunk.cs#L144 ). I haven't found a clean way yet to separate those and prevent the branching.Solution
It might be easier and more efficient to create a
feature/native
branch instead that ONLY uses native memory for those arrays. Classes and references would be forced to lay outside the ECS, but it would be a good fast alternative to the master for those wanting the maximum performance.feature/unsafe
would be obsolete and discontinued in favor offeature/native
.The text was updated successfully, but these errors were encountered: