Also agreed - most programmers don't have clue about performance, not only the C++ ones. However, many C and C++ programmers I meet are often obsessed about performance. They post things like "is += faster than +" or they lose time for similar stupid things. This thread also shows it clearly - I posted a short oneliner, but instead of trying to show how to write a similarly simple C++ code, very soon someone states that my code is resource wasteful, slow etc., even though actually it is of very similar performance to the C++ code claimed to be "fast".
Funny, that obsession about performance is often not complemented with actual knowledge of how to write fast software. The PHP or Python programmers usually don't talk so much "wow, look ma, what a super fast piece of code I wrote". They usually accept that most parts of code are not optimal and optimize only what is needed. |
@xorebxebx: I agree that most programmers don't have a clue about performance. Fact is, if you want to have a clue about it, you have to know how your compiler works -- how it parses the input, how it generates code, how its optimizer works, and then you also have to know your hardware architecture -- pipelining, etc. etc. That is a lot of in depth knowledge, very little of which you're going to get in a college bachelors degree, perhaps even masters or phd as well.
That they post questions like "is += faster than +" I think is a
good thing. It shows they care about performance, which is better than being completely ignorant of it and writing code that is 10x slower than it should be all for want of an ampersand to pass a vector to a function by const reference instead of by value (I see this
all the time.) But C++ is about performance anyway: at least, on of the goals of the standards committee when changing the language is to not make programmers pay for what they don't use. For example, if your class/struct has no virtual functions, then you don't pay the memory cost for a vtable pointer. Yes, it may be true that C++ does not easily allow you to write the fastest code in all cases; perhaps it makes it impossible. That is a price that C++ programmers have to pay--it is the result of C++ being a general purpose language that can be used to solve essentially any programming problem from hello world to quantum simulations to launching rockets to word processors, etc, etc.
As for the responses you got, well, I think your past posting history is largely to blame. You've on many occasions attacked C++ on a C++ forum (if perhaps only to claim that Scala is better). The people that post here regularly are here because they enjoy C++ -- dare I say they
love C++. It is only human nature for a person to defend something they take to heart when it is attacked, and what I saw in this thread was, I feel, largely a knee-jerk over-reaction, but I think that was because of the number of arguments with you in the past.