Serious TTREE Benchmarking: Random access

Hi Axel,

I came across this thread since I also noticed that random access in a TTree is very slow.

The program I am trying to run is not a benchmark, and there’s no way to do it sequentially. The program reads in a root tree and copies it with the entries sorted based on some values. While the algorithm is simple and the specifics are not too relevant but you can still take a look at it here if you’re interested: cmssw.cvs.cern.ch/cgi-bin/cmssw. … iew=markup

The first part of the algorithm reads the tree in sequential order which is fast enough.
The second part does stl quicksort on a simple array which takes no time at all.
The third part however attempts to get “random” entries from the original tree, corresponding to the sorted order, and fill a new tree in that order, and this part is far too slow.

For reference: the input file is 52 GB containing 1.5M entries and so far it seems it will take about 10-20 days to perform the third part of the algorithm.

Is there a way to make TTree::GetEntry work in fast constant time for random access?

Cheers,
Dragos