Is STL slow for tile/map based games

Started by
1 comment, last by rico 20 years, 6 months ago
if I use STL structures such as list or vectors in tile/map based games, will it have a speed/performance issue?
Advertisement
That would probably depend on what you where doing with them and how large you wanted them to be.. but in general NO, if you can write something faster your self then go ahead, but why would you want to do that?

I would say use the STL containers and get the game working... if you find it slow (don''t think you should) then rework the section that is using STL to use your own homebrew.

That way you''ll see results faster and will be able to work out your design.

Please visit Turt99 Productions
FOLLOW ME ON TWITTER OR MY BLOG
You shouldn't have any trouble with performance if you decide to use the STL - it was designed with performance as one of the main considerations and, as such, there are various performance guarantees in the spec. If you check http://www.sgi.com/tech/stl/ you can look up the performance guarantees for the various containers. For example, vectors have guaranteed constant time access to random elements, and constant time appending values to the end of a sequence (i.e. Vector:ush_back()).

Generally, if you find that you can do something faster yourself than with STL, it's because you're not using the STL properly. Of course, there'll be situations where the STL isn't a perfect fit and some other solution would be more suitable, but those occasions should be fairly rare. (Which is why I said "generally" above.)

[edited by - hinch on September 23, 2003 9:08:01 AM]

This topic is closed to new replies.

Advertisement