https://github.com/root-project/root
Revision ebc047bc39d9500d879a018a392cd551e9d28f69 authored by Rene Brun on 24 March 2005, 07:13:35 UTC, committed by Rene Brun on 24 March 2005, 07:13:35 UTC
a THashTable with a rehash level is incredibly inefficient when calling
AddAll(TCollection* col) on it. It rehashes ever single time an added
object brings it above the rehash level (which in turn adds all elements
added to far to a new THashTable) - this can happen very often, esp if
col->GetEntries()>>GetEntries().

The attached patch adds THashTable's own implementation of
TCollection::AddAll. Before calling TCollection::AddAll, it estimates
whether rehashing will be needed for the combined THashTable. Rehashing
before TCollection::AddAll means less elements will have to be copied to
the rehashed THashTable. The estimate is based on fSize, assuming an
ideal hash. If the collection wasn't rehashed before the call to
TCollection::AddAll, THashTable::AddAll will check for rehashing after
the collections have been merged.

The results should be exactly the same as with the old algorithm, only
the performance is many orders of magnitudes better, noticeable esp when
adding a larger collection.


git-svn-id: http://root.cern.ch/svn/root/trunk@11419 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent 7d9b34a
History
Tip revision: ebc047bc39d9500d879a018a392cd551e9d28f69 authored by Rene Brun on 24 March 2005, 07:13:35 UTC
From Axel:
Tip revision: ebc047b

back to top