Found this quite entertaining article. It's basically a typical "C vs. C++" one that does, in the end, only cover the basic fact that it's not the decision between C or C++ but the decision with alghorithm to choose. I don't quite agree with what's said there, mostly cause the idea of "give me some better algho and C is faster" is plainly stupid. However, he tried to accomplish a completely equivalent C++ version but forgot that his C++ is a) probably inlined cause it's defined in the class body and b) does additional things and thus isn't completely equal. Guy, if you gonna compare C and C++, you better start off using the C++ variant and try to rebuild it using C. In a nutshell, the C++ equivalent results in quicker code to do implicitly done stuff that's not done in C but could be. Especially inlining by the compiler (I remember there are some with rather automatic inlining when optimizing) is a factor not to ignore here. If you don't specify it in C, it's mostly not added. But well, in C++ it sometimes happens in methods (if you specify them there). So all in all one should better compare an inlined C version or a version with the code directly inserted by hand instead of just doing it like they are used to.

So sensitive stuff and yet he's doing it so wrong. It's a marginal rant, yes, but I mean he even mentioned that people either write right or wrong C++... Ignoring such facts like inlining does rather result in seeing him not that capable of writing C++ if it's about pure performance. Oh man, I clearly read to many things about inlining and optimization of functions calls. I don't I'm an expert in optimizing alghorithms themself, but inlining is so far the stuff I know a fucking lot about if it comes to that. Of course, not every situation I can't decided whether it does or not, but using a differently compiled C++ program to compare an again differently compiled C program is just false by default. However, I totally agree with what he wrote about the actual features C++ gives you. And seeing how amazingly easy the use of STL seems there... Geez, I might use in my next assignment for component-based development. Atleast I hope I can do something easy this time and not a whole PGN parser and model renderer....

No comments: