Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Container for Look Up to be Fast

Reply
Thread Tools

Container for Look Up to be Fast

 
 
Jorgen Grahn
Guest
Posts: n/a
 
      08-16-2011
On Tue, 2011-08-16, Leo Equinox Gaspard wrote:
> Le 13/08/2011 14:22, Jorgen Grahn a écrit :
> [...]
>> [...] Maybe also try to
>> go from an unordered_map<Key, Value> to unordered_map<Key, Value*> to
>> see if that is more cache-friendly.
>>
>> /Jorgen
>>

>
> I don't think an unordered_map could be easily cached, because of its
> random-like distribution. So, except if you are always requesting the
> same elements, I don't think processor cache could choose which of the
> thousands of data you got in your map it should cache.


True, but my idea was that unordered_map<Key, Value*> might be better
than unordered_map<Key, Value>, which was what he was already using
and was apparently pretty happy with.

> BTW, to get better advices, you (Pallav singh) could say how much a
> data is (10GB of 8B data isn't treated by the same data structure as
> 10GB of 1GB data).


Yes, moving to unordered_map<Key, Value*> can only be useful if his
value type is much bigger than his key. I forgot to point that out.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
container inside container in stl wolverine C++ 2 07-24-2006 03:08 PM
Copy elements from one STL container to another STL container Marko.Cain.23@gmail.com C++ 4 02-16-2006 05:03 PM
std::transform container => std::abs(container) Steven T. Hatton C++ 4 12-05-2004 07:10 AM
STL: container's values setup by another container Maitre Bart C++ 2 02-11-2004 12:11 AM
std::container::iterator vs std::container::pointer Vivi Orunitia C++ 11 02-04-2004 08:09 AM



Advertisments