Time of TNode->Clone()

Alexander Zvyagin (zvyagin@mx.ihep.su)
Wed, 18 Feb 1998 21:28:34 GMT+03:00


IHEP, Protvino, Russia, 18-FEB-1998

Dear all!

I have next macro:

// File b.C
void b(UInt_t N)
{
if( N==0 ) N=1;

gROOT->Reset();
g1 = new TGeometry ("Tempory","Tempory geometry");

new TBRIK("MAIN","This is main frame","void",10,10,10);
main_node = new TNode("MAINnode","This is main node","MAIN");
main_node->BuildListOfNodes();
main_node->cd();

new TBRIK("A","A","void",1,1,1);
Anode = new TNode("Anode","Anode","A");

TStopwatch timer;
timer.Start();

for( int i=0; i<N; i++ )
{
TNode *node = (TNode*) Anode->Clone();
if( NULL==node )
{
printf("Can not create node.\n");
exit(1);
}
main_node->GetListOfNodes()->Add(node);
}

timer.Stop();
printf("N=%d rate = %g seconds per node\n",N,timer.CpuTime()/N);

return;
}

ROOT session:

*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 1.03/09 16 December 1997 *
* *
* You are welcome to visit our Web site *
* http://root.cern.ch *
* *
*******************************************

CINT/ROOT C/C++ Interpreter version 5.13.36, Nov 30 1997
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .x b.C(7);
N=7 rate = 0.0128571 seconds per node
NULL
root [1] .x b.C(8);
N=8 rate = 0.025 seconds per node
NULL
root [2] .x b.C(9);
N=9 rate = 0.0555556 seconds per node
NULL
root [3] .x b.C(10);
N=10 rate = 0.148 seconds per node
NULL
root [4] .x b.C(11);
N=11 rate = 0.541818 seconds per node
NULL
root [5] .x b.C(12);
N=12 rate = 2.43833 seconds per node
NULL
root [6] .x b.C(13);
N=13 rate = 10.64 seconds per node
NULL

The time of TNode::Clone() + TNode::GetListOfNodes()->Add() depends strongly
from nodes amount.
Why?

Thanks,
Alexander Zvyagin.