4 ms·
C++ slower than C? Isn't that the same thing? Most of the time when I hear "C++ is slow" it usually means someone ran into slow STL+compiler combination. And ac
by tx 19y ago
C++ slower than C? Isn't that the same thing? Most of the time when I hear "C++ is slow" it usually means someone ran into slow STL+compiler combination. And according to my knowledge GCC is the worst performing compiler out there when it comes to optimizations. BY FAR. Intel and MSVC++ 7.1 eat it for breakfast, even with microsoft's profile-guided optimization turned off.
And by the way, why is it always Java guys who's playing with these benchmarks? Looks like an "inferiority syndrome" to me, C++ hackers just don't seem to care. Do you know why? Because good (performance-minded) C++ programmer has very good idea what kind of assembly instructions his code will turn to. This is why performance-critical code is still written in C++.
- nickb 19y agoSTL does have a few tarpits and once you know which classes to avid, it's smooth cruising. I recommend Scott Meyer's Effective C++ books if you want to learn how to avoid a lot of C++ performance black holes: http://www.aristeia.com/books_frames.html http://www.aristeia.com/books_frames.html Yes, the choice of a C++ compiler does make some difference in algo heavy functions/methods but the art of writing high performance C++ programs has a lot more to do with overall design (which is sometimes C++ specific) and your programming style. I left C++ programming but if that's your cup of tea, look into Meyer's books. They're the best. Java guys care because of Java's history: it was always slower than compiled languages and Java dev got a lot of crap for not having fast runtime. That's all history but there's still a ton of people out there who refuse to download Java-based programs because of 'slowness' myth.