CINT massively slow with functions

Hello,

I have been running an ever increasing monte-carlo simulation of an atom beam as it exists a Magneto-optical trap and then it’s interaction with multiple laser beams.

Recently I had to add some code that is called upon multiple times. I immediately did this by declaring a function (just as you would do in plain C++). The simulation seemed to work but became MASSIVELY slow!

After searching unsuccessfully, for hours, for a bug in my code I decided I would get rid of the functions and just duplicate the code when needed. This solved the slowness issue completely. Now my script’s performance is back to what it used to be.

I assume that if I were compiling my code, instead of running it as a script, I would have had no trouble…but why does CINT have so much trouble with my functions?

run your CINT script with the ACLIC interface, ie if you have myscript.C
root >.x myscript.C executes with the CINT interpreter
root > .x myscript.C+ executes via ACLIC and uses the native compiler.

To use ACLIC your script must be valid C++, ie with the include declarations at the top of your script.
For more details see the very first pages of the Users Guide

René