[computer-go] Language War!

Darren Cook darren at dcook.org
Mon Jul 31 00:45:17 PDT 2006


> STL:
> Normally a special purpose data-representation is faster than a general
> purpose one ...

STL is slow for the same reason that java is: dynamic memory
allocations. I usually use an STL container when writing and testing
code, then if profiling shows it is a bottleneck I write a custom
replacement class which avoids memory allocations (or uses a custom
memory pool).

I find std::set is the one I'll replace most often; std::vector is quite
reasonable, especially if you know how many items you'll typically put
into it (i.e. in that case use reserve() up front). See Meyer's
Effective STL for other ideas.

And for anyone doing any serious C++ I'd highly recommend Meyer's two
earlier books: Effective C++ and More Effective C++.

When you find C++ seems to be missing some key library that
java/php/whatever have, check out boost (www.boost.org). There is often
a bit of a learning curve, but generally they've paid attention to
performance.

Darren





More information about the computer-go mailing list