3 ms·
I have measured abstraction overhead in C++ for 20+ years. It was significant in the early 2000s. It is zero today. That does not mean C++ programs are necessa
by ncmncm 6y ago
I have measured abstraction overhead in C++ for 20+ years. It was significant in the early 2000s. It is zero today.
That does not mean C++ programs are necessarily fast: it has always been easier to write slow programs, in any language. It doesn't mean C programs must be slow: making a fast C program just takes a great deal more work, and time, than a fast program in modern C++, so the extra time taken has been wasted.
You are always free to waste your own time. Wasting your employer's time is often less defensible. In the fintech world, suggesting C as a way to speed up a C++ program would get you laughed out of the room, at best.
The common experience noted in the original page is that C++ programs are faster than C programs. We know why.
That the chess program was easy to transcribe to C demonstrates that it was not good C++ code -- which you also revealed yourself. Making a faster C program while transcribing an almost-C C++ program is no big trick.
I routinely speed up programs by 2x by changing only a few lines. A 10-20% improvement in a whole rewrite is a great waste of time. Translating to asm, moreso. I would call a 10-20% improvement negligible, and crediting it to C delusional.