ROOT 5.16 slow with lots of histograms, still the case?

Hi,

I’m trying to use ROOT with lots of histograms (O(20000)) where I continuously replace sets of O(4000) by other sets (I’m trying to do floating averages of our 5000-channel calorimeter’s calibrations, that’s how the large numbers come about). My code becomes absurdly slow once I have more than approx. 15000 histograms. Namely, deleting histograms becomes an expensive operation, details below. My question is: is this fixed in recent versions (newer than 5.14/00e)? I’m basically tied to that version, as that’s what’s provided where I work, but if you tell me that the issue is fixed in later versions then that should be a good reason to upgrade for our admin.

A typical debugger backtrace taken at a random point in time looks like this:

code where
#0 0x004d0200 in TList::FindLink () from /grid/fzk.de/mounts/nfs/software/compass/root/v5.14.00e/slc4_ia32_gcc34/root/lib/libCore.so
#1 0x004d04e4 in TList::Remove () from /grid/fzk.de/mounts/nfs/software/compass/root/v5.14.00e/slc4_ia32_gcc34/root/lib/libCore.so
#2 0x004cde5e in THashList::Remove () from /grid/fzk.de/mounts/nfs/software/compass/root/v5.14.00e/slc4_ia32_gcc34/root/lib/libCore.so
#3 0x04adc0ab in TH1::~TH1$base () from /grid/fzk.de/mounts/nfs/software/compass/root/v5.14.00e/slc4_ia32_gcc34/root/lib/libHist.so
#4 0x04af3719 in TH1S::~TH1S$delete () from /grid/fzk.de/mounts/nfs/software/compass/root/v5.14.00e/slc4_ia32_gcc34/root/lib/libHist.so
#5 0x0571c1ee in calcFloatingScalings (run=70494, histos=@0xbfef14e0) at /grid/fzk.de/mounts/nfs/home/schluter/elastic/./rootscripts/readCalibs.C:190

[/code]
In other words, most time is spent trying to delete histograms. My guess is that the hashlist’s key is too short to deal with the large number of similarly named histograms.

Best regards, and thanks for any information.

Ok, I see to have found a solution after one day of experimenting with the naming of the histograms :slight_smile:
I now put my temporary histograms into a directory of their own. Anyway, at least in ROOT 5.14 there’s a problem with very large directories.

[quote]I now put my temporary histograms into a directory of their own.[/quote]Since they are temporary, you could also not attach them to any directory (myhist->SetDirectory(0)) but then you need to make sure to keep track of them in your code.

Cheers,
Philippe.

PS. Yes the behavior should be not has bad in newer version of ROOT.

[quote=“pcanal”][quote]I now put my temporary histograms into a directory of their own.[/quote]Since they are temporary, you could also not attach them to any directory (myhist->SetDirectory(0)) but then you need to make sure to keep track of them in your code.[/quote]Thanks, that’s a good idea I should have thought about. I keep track of the histograms myself anyway, as I need to operate on them, and I was very annoyed that the double bookkeeping is costing me so much time, but I didn’t realize that one could turn off ROOT’s.

[quote]PS. Yes the behavior should be not has bad in newer version of ROOT.[/quote]Good to know.

Thank you very much!