Root reading speed issue

We have a RAID system which is capable of sustained IO at speeds up to 500MB/s (half a gig per second). We’ve actually tested this using benchmarking tools, and we have indeed seen these speeds.

However, we don’t see anywhere near this sort of speed when using ROOT. If we have a TFile object with with a TTree inside, and we read the whole TTree into memory, the read speed is something more like a sluggish 4MB/s, or two whole orders or magnitude slower than the optimal IO capacity of the RAID device.

There’s no network IO involved here either. All of these tests are being done locally on the machine which is physically hooked into the RAID.

We tried to throw a TTreeCache application in there too, but the IO performance didn’t improve.

Does anyone have any ideas about why ROOT TFile reads might be so slow? Is this something to be expected, or can we fix it somehow?


when reading a TTree, behind the scenes, ROOT performs several operations, not just plain reading.
It of course reads bytes from disk but also decompresses buffers and it deserialises them to fill the representation of the objects in memory. The speed of reading depends on many factors, the maximum throughput of the storage device being one of them.
For example, it depends by what you mean by “reading the whole TTree in memory”: what is actually done in your benchmark? Other critical factors are the compression algorithm used to create the file and the compression level. The structure of the tree counts as well, namely the type of objects stored (simple pods, intricated nested stl containers etc.).
As for improving the read and write speed: we are working on it! It is a fundamental aspect for many operations, for example analysis of large sets of events. Many areas are being investigated such as for example new faster compression algorithms or the exploitation of multicore architectures.


You must have something badly wrong in your data model (abuse of inheritance layers, object streaming instead of memberwise streaming).
With a well designed data model, you should be able to reach 80 MBytes/s with your device.
Could you post the result of TTree:Print or use TTreePerfStats to understand where you spend the time?