some of the pointer type describe a lot of data, and sometimes, the opaque types (as this relates to the opaque pointer pattern) store more data than just a pointer. for chunks, this is a BitMask of the types, then a pointer to the chunk data, then pointer to component offsets from the schema (as its often accessed) then finally tag types last.
|
public readonly BitMask componentTypes; |
|
|
|
internal ChunkPointer* chunk; |
|
internal uint* componentOffsets; |
|
|
|
/// <summary> |
|
/// Retrieves the tag types stored in this chunk. |
|
/// </summary> |
|
public readonly BitMask tagTypes; |
my thinking for this is that those pieces of data are accessed often enough that its valuable to have them directly available. but this adds a cost to iterating over chunks, no longer its going through 8 byte size pieces. instead it goes through 32 + 8 + 8 + 32 sized pieces. it makes it quicker to get/set components, at the cost of slightly slower querying.
would be valuable to compare different layouts and see which performs best for querying.
some of the pointer type describe a lot of data, and sometimes, the opaque types (as this relates to the opaque pointer pattern) store more data than just a pointer. for chunks, this is a BitMask of the types, then a pointer to the chunk data, then pointer to component offsets from the schema (as its often accessed) then finally tag types last.
worlds/core/Chunk.cs
Lines 19 to 27 in b23a004
my thinking for this is that those pieces of data are accessed often enough that its valuable to have them directly available. but this adds a cost to iterating over chunks, no longer its going through 8 byte size pieces. instead it goes through 32 + 8 + 8 + 32 sized pieces. it makes it quicker to get/set components, at the cost of slightly slower querying.
would be valuable to compare different layouts and see which performs best for querying.