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 .
|