On Sun, Jun 05, 2005 at 10:12:06PM +1000, Erik de Castro Lopo wrote:
It should be noted that the benchmark attempts to use
the technique
most approriate for the language. So, for the count words example,
the C++ version uses std::vector from of the STL:
http://shootout.alioth.debian.org/benchmark.php?test=wc&lang=icpp&i…
while the C version uses standard C arrays:
http://shootout.alioth.debian.org/benchmark.php?test=wc&lang=icc&id…
Are you surprised that C arrays are faster than std::vector?
I'm not, but there's no good reason for not using C arrays in C++. STL is just
a library, it's not part of the language, and you're free to use it or not.
My aproach to C++ is very simple: I use it as 'C with classes'. No streams, no
STL, no other nonsense. Gives me the best of both worlds - clean objects and
low level.
--
FA