M
Martijn Lievaart
Doing a few simple modifications (pass per const reference instead
of pass per value, using += instead of +, using std::string instead
of some homegrown string class) speeded the program significantly
such that it was faster then either of the other 2 languages.
Moral: While not caring for technical details is a good habit, one
nevertheless has to know his toolkit, to select the right tool for
the right job. And of course: knowing typical idioms helps.
Yes, I understated (is there such a word?) the gain one can get, in some
cases this /can/ be significant.
Also, using simple idioms (passing by const reference is very important,
and not only for efficiency btw) one can avoid some performance pennalties.
But I tried to echo your sentiment about the obsession with speed some
newbies have. Hey I program 95% in Perl nowadays, I seldom reprogram in
another language for speed. Speed just seldom is an issue anymore.
But to the OP, there are some easy ways to avoid inefficiencies.
F.I. knowing about passing by value and by reference can save potential
copies, and those copies can be expensive. As you have to learn about
these issues anyhow, you'll learn to avoid needless copies as well.
M4