| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Fri Jul 28, 2006 9:10 am Post subject: which will be more efficient Stdlib MAP or Array /w sequenti |
|
|
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
|
Posted: Fri Jul 28, 2006 9:10 am Post subject: Re: which will be more efficient Stdlib MAP or Array /w sequ |
|
|
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
|
Posted: Fri Jul 28, 2006 9:10 am Post subject: Re: which will be more efficient Stdlib MAP or Array /w sequ |
|
|
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 |
|
 |
|