http://GameProgrammer.Com

Programming

GP Mailing List
     Thread Index
     Date Index

ATXGPSIG List
     Thread Index
     Date Index

Google
>

Home

Wise2Food



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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