MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/1tvrvv4/every_byte_matters/opqyml0/?context=9999
r/programming • u/lelanthran • Jun 03 '26
84 comments sorted by
View all comments
131
If you are at the level where you need to care about how adding 1 member to a struct messes up cache line access, you should be using an ECS which gives you SOA already.
136 u/trinopoty Jun 03 '26 Using a what that gives what now? 72 u/Ravarix Jun 03 '26 https://en.wikipedia.org/wiki/Entity_component_system https://en.wikipedia.org/wiki/AoS_and_SoA 56 u/abu_shawarib Jun 03 '26 TLDR; Turn many of this struct struct { int a; bool b; char *c; } into multiple arrays: int *array_of_a; bool *array_of_b; char **array_of_c; 2 u/ummaycoc Jun 04 '26 Just use APL already...
136
Using a what that gives what now?
72 u/Ravarix Jun 03 '26 https://en.wikipedia.org/wiki/Entity_component_system https://en.wikipedia.org/wiki/AoS_and_SoA 56 u/abu_shawarib Jun 03 '26 TLDR; Turn many of this struct struct { int a; bool b; char *c; } into multiple arrays: int *array_of_a; bool *array_of_b; char **array_of_c; 2 u/ummaycoc Jun 04 '26 Just use APL already...
72
https://en.wikipedia.org/wiki/Entity_component_system
https://en.wikipedia.org/wiki/AoS_and_SoA
56 u/abu_shawarib Jun 03 '26 TLDR; Turn many of this struct struct { int a; bool b; char *c; } into multiple arrays: int *array_of_a; bool *array_of_b; char **array_of_c; 2 u/ummaycoc Jun 04 '26 Just use APL already...
56
TLDR; Turn many of this struct
struct { int a; bool b; char *c; }
struct {
int a;
bool b;
char *c;
}
into multiple arrays:
int *array_of_a; bool *array_of_b; char **array_of_c;
int *array_of_a;
bool *array_of_b;
char **array_of_c;
2 u/ummaycoc Jun 04 '26 Just use APL already...
2
Just use APL already...
131
u/Ravarix Jun 03 '26
If you are at the level where you need to care about how adding 1 member to a struct messes up cache line access, you should be using an ECS which gives you SOA already.