4 ms·
> RAII ownership semantics (I.e. std::unique_ptr) RAII is baad for performance. Really bad. It's an OOP programming style that can be used to glew a few high-l
by jstimpfle 7y ago
> RAII ownership semantics (I.e. std::unique_ptr)
RAII is baad for performance. Really bad. It's an OOP programming style that can be used to glew a few high-level constructs together. But if you use it on the lower levels, you will miss out on a lot of (systemic) optimization possibilities, because RAII gives you piecemeal construction/destruction pairs.
constexpr/generic programming might have a few nice applications, but in most places they're used without a real need (from what I've seen), while leading to extremely slow compiles. (Those in turn lead to longer turnaround times, worse program quality, worse efficiency...).
std::array, like std::vector, is some nice sugar compared to the C primitives, but if you use them at API boundaries you will get bad coupling effects.
The C++ programmers that I look up to all write basically C with maybe a few select C++ features. Many never write "class" and never include C++ headers. Some just write plain C.
- pjmlp 7y agoCurious, do you look up to Mike Acton?
- jstimpfle 7y agoI've never seen him programming, but he seems like a very knowledgeable guy. I find a lot to agree with in his talks.
- pjmlp 7y agoYeah, because now he is one of the devs leading the High Performance C# effort at Unity. People do change their mind.
- jstimpfle 7y agoI know, and I can't follow your conclusions. (Btw. come to Handmade Seattle, he will give a talk there ;->)
- pjmlp 7y agoFor someone that used to advocate C, did not like C++ features, I find peculiar that he now stands behind C#. Yes, I do know that HPC# is somehow constrained, yet even as C# subset, it still supports quite a few features that Mike wasn't so found of having to deal with in C++, as per his CppCon talk.
- jstimpfle 7y agoWe don't know how he's using C# there. What are the clues that you base your guesses on? I don't know a lot of C#, but it can probably be used responsibly in a high performance setting. It seems he's still working on the same ideas and themes that his (in)famous talk from CppCon was about. Check this out, for example: https://twitter.com/Icetigris/status/1116771416072806401 https://twitter.com/Icetigris/status/1116771416072806401 . As far as I'm concerned, that's basically C. Btw, have you updated your idea of ECS and "Data-oriented design" in the meantime? (Man, I've really started to be annoyed by this buzzword!)
- pjmlp 7y agoWell, for starters it is impossible to use C# without some form of OOP and its type system goes against the spirit of "Performance begets safety" from C devs like Mike.
- jstimpfle 7y agoAre you just trying to win an argument? Please look at what they actually do, and then maybe let's have a discussion about that. In any case I'm sure Mike is way more pragmatic than you imply, and couldn't care less about language labels as long as he can do his thing. Btw for extreme data-oriented programming you might actually be able to afford GC, provided you have value-type compound types like I think C# has. That's because there are only a few allocations around. Not that GC matters in this case - you don't free the global tables anyway except maybe at the end. And bounds checks might be easier to optimize out (?).