If there is a performance difference between pyroot and c++ root in processing ROOTFiles like some computation of physical qualities?

Hello,
I’m processing some large size files ,computing some qualities and then adding them into the rootfiles as a new branch. But the speed of processing files is time consuming using pyroot. I am wondering if there is a difference in performance in handling rootfiles.

Hi @realTay_John ,

yes, very much. Doing for event in tree in Python is much slower than, e.g. looping over a TTree from C++, or using RDataFrame (which is meant to be the sweet spot between usability and performance).

The level of code optimization also matters: until ROOT v6.24, PyROOT and interpreted ROOT macros run at O0 (i.e. user code will be unoptimized code – although ROOT library code will be optimized), while macros compiled with ACLiC (root macro.C+, with a plus) or compiled C++ programs will generally run at O2 or O3 optimization level (often factors faster). In v6.26 the different will be much smaller as PyROOT and interpreted ROOT macros are just-in-time-compiled at O1 optimization level.

Cheers,
Enrico

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.