Re: OT - How Important is Performance In Modern C++ Development?
On 29 Okt, 08:14, "jehugalea...@gmail.com" <jehugalea...@gmail.com>
wrote:
I have been living in the world of C# for the past 3 years. I have
recently been diving back into C++. In order to get my mind back in
the game, I picked up my copy of Scott Meyers' Effective C++. I have
been surprised just how much he seems to emphasize performance.
So, is performance that important in the C++ programming community?
Yes, it is. Just to give you an idea of how seemingly trivial
details affect performance, one of my recent data processing
programs reduced run-time by 90 seconds merely by switching
off a boundary check in the STL containers.
As I understand it, Microsoft Visual C++ by default checks if an
index into a std::vector<> are within a valid range. In its simplest
form (I don't know if this is how the checks are actually
implemented,
or if there is more to it) this would amount to wrapping the core of
std::vector<>:operator[](size_t i)
into a range check, like
if ((i>=0) && (i<this->size()))
{
...
}
else
{
throw(someException);
}
You can remove that kind of check by switching some compiler
directives. Again, when I did, the run-time went down by some
90 seconds, or about 30%, from a bit less than 4 minutes to a
little more than 2.
Those kinds of things matter. The goal is to get the program
in question to run in less - a lot less - than 15 seconds.
C++ is the reason why I attempt to implement this processor
at all: C++ balances high-level code semantics with low-level
performance. There are tools out there that do what I want
my tool to do, but they perform so badly that users literally
go out of business, since they are unable to deliver both on
time and according to spec.
Rune
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]