gSystem->CompileMacro vs. g++

I inherited some a computation intensive ROOT GUI macro which runs as compiled code by using #if defined(__CINT__) && !defined(__MAKECINT__) { Info("myMacro.C", "Has to be run in compiled mode ... doing this for you."); gSystem->CompileMacro("myMacro.C"); myMacro(); } #else.

This code works but I want to get rid of the GUI so I can run it in batch. I took out the GUI code and now compile it with g++. This version also works OK. However, I have found that the g++ version is 2x slower than the compiled macro version. This difference surprises me. I expected that the the g++ version would be slightly faster or the same. Is there anything in general which would make the g++ version slower?

Thanks for any suggestions.

The difference is likely due to a different optimisation level.
Note that you can invoke CompileMacro (or gROOT->ProcessLine) in batch too. These functions are not related to the GUI at all.

Rene

the g++ compiler flag -02 fixed the problem.

Thanks Dr. Brun.