[gameprogrammer] Re: faster lookup, lists, vectors, maps?

  • From: Matthew Weigel <unique@xxxxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Fri, 13 Jul 2007 09:09:49 -0500

Roger D Vargas wrote:
> I would like to know what STL container provides faster access time in
> short lists of elements. In my game, entities have some properties:
> basic stats, attributes and skills, which I plan to unify under a single
> data structure. Such lists of properties are accessed by scripts and
> currently Im using lists. Does vectors or maps provides faster access
> when number of elements is less than 10-20?

You should probably benchmark it in a small test program, for speed... But I
would guess that yes, maps (in particular) would be faster.  Particularly if
you're using something expensive to compare against like strings.
-- 
 Matthew Weigel
 hacker
 unique & idempot.ent

---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: