TExMap

Hi,

I seem to notice that the TExMap::GetValue performance can vastly depends on the number of items in the map, or, to be more precise, on the ratio of size over capacity. Is that true ?

Is the performance predictable ?

Thanks,

Hi,

yes that is true. If there are many collisions then several slots have to be tried to find the right entry. This can happen because your table is almost full or because you have a poor hash function that hashes to the same slot.

Cheers, Fons.

I do not use a hash function at all :blush:
as I want the equivalent of std::map<int,int> basically (which I can not use).
But maybe even in that case I should use a hash then ?
Or are there more relevant map implementations I could use in such a case ?

Thanks,

map<> does not use hashing. To use TExMap you have use a hash as otherwise it will use the int as aa hash and if they are always the same it will behave as a bad hash function.

– Fons

Is there a good hash function for integers somewhere in Root to be used ?

Integers are already a hash. If they are sufficiently heterogeneous they are a good hash. If they are all the same there is not much you can do about them to differentiate them :wink:

Cheers, Fons.