C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

which will be more efficient Stdlib MAP or Array /w sequenti

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Fri Jul 28, 2006 9:10 am    Post subject: which will be more efficient Stdlib MAP or Array /w sequenti Reply with quote



Hi was contemplating the use of either MAP or Hashtable for keeping a
cache of objects with name as the key to object. I would be searching
the MAP/Array/Hashtable often now for such a small number, which would
be quicker and how exactly does MAP search?

Thanks
Ankur
Back to top
Mark P
Guest





PostPosted: Fri Jul 28, 2006 9:10 am    Post subject: Re: which will be more efficient Stdlib MAP or Array /w sequ Reply with quote



g35rider (AT) gmail (DOT) com wrote:
Quote:
Hi was contemplating the use of either MAP or Hashtable for keeping a
cache of objects with name as the key to object. I would be searching
the MAP/Array/Hashtable often now for such a small number, which would
be quicker and how exactly does MAP search?

Thanks
Ankur


First of all the standard library provides "map" not "MAP".

To answer your last question, it's implementation dependent but
typically it's a binary search on a red-black tree.

As to your original question, there's not enough information here to
provide a useful answer. How many objects? How many searches? Will
the contents of the container change between searches (insertions or
deletions?)? If you can better define the parameters we may be able to
take an educated guess but the best idea is to try each and see which is
faster (if you can observe any difference at all... 1000 searches is
really very little on modern hardware).

Mark
Back to top
Guest






PostPosted: Fri Jul 28, 2006 9:10 am    Post subject: Re: which will be more efficient Stdlib MAP or Array /w sequ Reply with quote



To be clearer, the data size could be anywhere from 50-1000 objects and
access could be around 1-10 times a sec.

Thanks
Ankur
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.