ROOT, cling and O2 optimization

Hi ROOTers,

I am using root 5.34/32 and pyROOT. I would like to invoke a C ROOT code from pyROOT for looping around a few hundred million values. I’ve noticed that the code is not so fast in in cling, even when executed with …C++O. However, the speed is similar to the speed I get when compiling standalone with gcc -O. However, gcc -O2 gives much faster results.

So the question now is, can I get from cling with C++O the same results as for compiling with gcc and -O2? I understand I can change the CMAKE_BUILD_TYPE to Optimized, but I am not sure if it means O1 or O2. I am also not sure if C++O will follow that. Any advice?

Try to play with ACLiC’s behaviour:

gSystem->GetFlagsDebug()
gSystem->GetFlagsOpt()

gSystem->SetFlagsDebug("");
gSystem->SetFlagsOpt("-O3 -DNDEBUG");

gSystem->GetMakeSharedLib()
gSystem->GetMakeExe()

gSystem->SetMakeSharedLib(…);
gSystem->SetMakeExe(…);

If CMAKE_BUILD_TYPE is ‘Optimized’ the build of ROOT is done with -O3, with ‘Release’ is -O2. But, if I am not mistaken, this don’t help for the Jitted code in cling, which is still done with -O0. ACLIC would probably be a better solution as suggested by Pepe.

Thanks! The gSystem->SetFlagsOpt("-O3 -DNDEBUG"); worked very well! And actually in the topic I meant CINT not CLING (ROOT 5.34) and, as indirectly pointed out, really ACLIC.