No. You can't make sweeping generalizations like that. There are so many issues (e.g., algorithms or threading) that go into benchmarking whole applications that you can't pin it all on the difference between C and C++. I don't want aspiring programmers to read this chain and think "I picked the uber language, so my code is as fast as it could be!" No. Just, no.MagicPoulp wrote:The apache httpd webserver is in C++. nginx is in C. The latter wins all the benchmarks. And this is because it has no overhead from object-oriented rules.
I have consistently suggested resources and tools that will help you address your concerns. The reason people write C/C++ as if they are interchangeable is that C++ programmers will select from pure C techniques, generic algorithms, static polymorphism, dynamic polymorphism, etc. as needed. For most, this is not some religious issue. The difference between C and C++ is extremely small for most cases. What I want to encourage aspiring programmers to do is pick the right techniques for the problem. The key is to use the tools I suggested (e.g., Compiler Explorer) and a good benchmarking library (Google Benchmark is pretty good). Also, watch the many, many excellent C/C++ conference talks on YouTube.
[Edit:] By the way, one advantage of nginx is a better architecture. Mainly, queueing to make better use of threads.