[gameprogrammer] Re: c++ template problem
- From: Brian <brian.ripoff@xxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Tue, 21 Jul 2009 23:16:50 +0100
Hi.
> I wouldn't be too sure about that. A case has hit us not too recently at
> work. One of my co-workers used an STL Vector for storage and this code was
> to replace some C# equivalent code.
> ...
> We replaced the code with a straight 'C' implementation and that gave us a
> performance metric we were expecting, which was closer to taking half the
> time as the C# implementation.
Microsoft's Visual C++ 2005 and later shipped with a set of related
features in the C++ Standard Library, called "Secure SCL" and
"Iterator Debugging". For some reason, these are enabled even in
"Release" builds.
There are preprocessor defines that will remove these "features".
However, if you are using any precompiled C++ libraries that use the
standard C++ template library in their interface you will need to
ensure that such features are enabled/disabled uniformly across the
libraries and your program.
There is no reason why a sane std::vector implementation cannot be
near optimal in "Release" configurations.
>> I'm not a professional, but I think vectors must be as efficient and
>> optimized as possible. And inheritance is too much in this case.
In sane C++ implementations, inheritance is essentially free
performance-wise when you aren't using virtual functions. That said, I
wouldn't use it here.
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
Other related posts: