Reading a TNtuple in pyROOT and ROOT

Hi,

I have a root-file that contains exactly one TNtuple that was previously created by a Python program (using the ROOT module). I have written 2 programs, one in C++ and the other in Python. Both do exactly the same thing, namely, loop over the entries in the TNtuple, read out some variables, check whether they are in some range, and increment a counter if they are. There problem is:

The Python program is approximately a factor 60 slower. Is that conceivable or should I be looking for a bug in my code?

Any suggestions what I should do to get to the bottom of this?

Best,

Akin

Hi,

is the C++ program compiled?

Cheers,
Wim

Yes, the C++ program is compiled.

Hi,

then such a speed difference is completely expected (and which is one reason why I’m working on a PyPy implementation, so that the reading code can be JIT-ed).

Cheers,
Wim