> Dear ROOTers,
>
> I do not understand why the function (in file "b.C")
>
> void b(void)
> {
> TPaveText t(0.05,0.05,0.95,0.95);
> for( int i=0; i<100000; i++ )
> {
> gBenchmark->Start("A");
> t.Clear();
> t.AddText("Slower and slower....");
> t.Draw();
> gBenchmark->Show("A");
> }
> }
>
>From the piece of the code of TObject::Draw below one may conclude
your macro does include one and the same object up to 100000 times
and forse the current Canvas (even it is dummy one for "-b" - batch mode")
to draw it over and over up to 100000 copies of the one and the same
TPaveText object. That's why it is slower and slower
> void b(void)
> {
> TPaveText t(0.05,0.05,0.95,0.95);
> for( int i=0; i<100000; i++ )
> {
> gBenchmark->Start("A");
> t.Clear();
> t.AddText("Slower and slower....");
> t.Draw();
> gBenchmark->Show("A");
> }
> }
The "right" test should look as follows:
void b(void)
{
TPaveText t(0.05,0.05,0.95,0.95);
t.Draw();
for( int i=0; i<100000; i++ )
{
gBenchmark->Start("A");
t.Clear();
t.AddText("Slower and slower....");
gPad->Modified();
gPad->Update();
gBenchmark->Show("A");
}
}
Hope this helps,
Valery
====================================
//______________________________________________________________________________
void TObject::Draw(Option_t *option)
{ AppendPad(option); }
//______________________________________________________________________________
void TObject::AppendPad(Option_t *option)
{
// Append graphics object to current pad. In case no current pad is set
// yet, create a default canvas with the name "c1".
SetBit(kObjInCanvas);
gPad->GetListOfPrimitives()->Add(this,option);
gPad->Modified(kTRUE);
}
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:39 MET