Re: performance of a program with MakeClass vs MakeSelector, and global variable

From: Marc Escalier <escalier_at_lal.in2p3.fr>
Date: Tue, 6 Jul 2010 22:28:15 +0200


thanks John for your suggestions,

my problem is that it doesn't compile for the following reason : when compiling, the histogram is unknown to the method of the class :

the reason is that :

{
TH1F *myhisto

InstanceOfClass.Loop(*without parameters*) }

with :
InstanceOfClass.Loop()
{
work on myhisto that still is accessible "because of the rules of cint" }

so it would not compile (i do interpreted code because it is easier to debug and because the gain in speed when compiling is only 10 %. I showed to Rene some time ago that indeed the gain was only 10 % for the specific way of class that i'm using where there is plenty of vectors, which is not optimized for root. But i don't have the choice about the class : it is an "official" format.)

thanks



On Tue, 6 Jul 2010, John Idarraga wrote:

> By the way, before running valgrind --tool=callgrind, compile your macro
> with debugging symbols
>
> 1) if compiling using ACLIC
>
> .L mystuff.C++g
>
> 2) if you are compiling by hand you need to pass this flag to g++
>
> -g3
>
> cheers,
>
> John
>
> On Tue, 2010-07-06 at 19:14 +0200, Marc Escalier wrote:
>> Hello,
>>
>> i observed a strange phenomena with root (i guess it doesn't depend on
>> the version, but just in case, it is root 5.22.)
>>
>> Let's consider a minimum program developped from a MakeClass() and a
>> concurrent one with MakeSelector()
>> *if the two programs don't fill histogram, i find the same performance
>> in time of execution
>>
>> *if i fill the histogram with a MakeClass approach or a MakeSelector
>> approach, for which the histogram has been declared in the main program
>> as a global variable
>> then the MakeSelector approach is about 10 times slower than the
>> MakeClass approach (doing exactly same stuff) (and with desactivation on
>> almost all the branches to speed up the process in the two cases)
>>
>> the program is something like :
>>
>> {
>> Declaration of a histogram
>> Call Instance of a Class and loop on it and fill the histogram with
>> dummy values
>> or
>> Call Instance of a Selector and loop on it and fill the histogram with
>> dummy values
>> }
>>
>> *if now, i put the histogram in "local variables" in the class of the
>> Selector (declaration in the header .h and memory allocation in the Begin())
>> then the performance of the MakeSelector approach is twice faster as
>> compared to the MakeClass approach
>>
>> Would you have an idea of the behaviour
>>
>> thank you very much
>>
>> just in case you would need more info on the program, it is here (lxplus) :
>> /afs/cern.ch/user/e/escalier/public/ForRene
>> time root -b -q -x main.C
>> to see the differences to apply, you can replace the differences by
>> making comment/uncomment of the parts with "option 1", "option 2",
>> "option 3"
>> (
>> "grep option 1" *
>> "grep option 2" *
>> "grep option 3" *
>> )
>>
>
>
Received on Tue Jul 06 2010 - 22:28:19 CEST

This archive was generated by hypermail 2.2.0 : Tue Jul 06 2010 - 23:50:01 CEST