3 ms·
> If you use C++ in the "default" object-oriented way, your program won't be as efficient as it could've been That’s way too general to hold any truth. C++’s c
by kaba0 6y ago
> If you use C++ in the "default" object-oriented way, your program won't be as efficient as it could've been
That’s way too general to hold any truth. C++’s classes are zero cost, SoA vs AoS is not always relevant. If I have three instances of my class, each doing something compute-intensive in a simple method, how is it different to dod?
Also, even virtual functions are not necessarily any more expensive than the alternative if one knows what he/she does.
- mort96 6y agoThe context of the discussion is one where the difference between SoA and AoS is significant. It’s not always true in general that your program won’t be as efficient as possible, but it’s true in the context we’re discussing, where you have a lot of things (entities or whatever) and you’re iterating through them, which is what is being discussed. I was writing a direct answer to the question of “how can it be true that C++ isn’t built for modern machines even though modern games with good performance on modern machines use C++”. I think the answer is entirely correct in context.
- kaba0 6y agoFair enough, sorry I misunderstood your point.