The Never Ending Story ... Part (Int_t)341514 + 3
Jacek M. Holeczek (holeczek@us.edu.pl)
Thu, 13 May 1999 14:56:21 +0200 (MET DST)
Hi,
This time some performance numbers, as this might be interesting for you.
The Loop/loop functions look, on principle, like this :
-----------------------
Loop(Int_t (*p2f)(ntuple*)) ...or... loop(ntuple *n)
{
Stat_t nentries = n->GetEntries();
for (Int_t i=0; i<nentries; i++) {
n->GetEvent(i);
#if 0 // test direct filling of the histogram
h_test->Fill(n->x()); // both h_test histogram and n::x() exist
#else // test filling of the histogram in a called function
if ((*p2f)(this)) break; ...or... if (test(n)) break;
#endif
}
}
-----------------------
The test "interpreted" function looks, on principle, like this :
-----------------------
Int_t test(ntuple *n)
{
h_test->Fill(n->x()); // both h_test histogram and n::x() exist
return 0;
}
-----------------------
The test machine is 2*PII/450 256MB RAM, RH5.2 Linux with root 2.21/08.
The "ntuple" itself has 341514 events.
Now come ( total ) execution times :
1. n->Loop() where "Loop" is a "compiled" code, and directly fills
the "h_test" histogram ( no function "call" inside "Loop" ) ->
about 0.5 sec
2. n->Loop(test) where "Loop" is a "compiled" code, "test" is
"interpreted", and IS NOT byte-compiled ( compiled code calls
interpreted NOT byte-compiled code ) -> 100 sec
3. n->Loop(test) where "Loop" is a "compiled" code, "test" is
"interpreted", and IS byte-compiled ( compiled code calls
interpreted byte-compiled code ) -> 2.8 sec
4. n->Loop(test) where "Loop" is an "interpreted" code, "Loop"
calls the "interpreted" "test" function ( interpreted code
"calls" interpreted code, NOT byte-compiled ) -> 333 sec
5. loop(n) where "loop" is an "interpreted" code, "loop" calls the
"interpreted" "test" function ( interpreted code "calls"
interpreted code, both byte-compiled ) -> 4 sec
6. loop(n) where "loop" is an "interpreted" code ( byte compiled
after first "use" ), "loop" directly fills the "h_test"
histogram ( no function "call" inside "loop" ) -> 2.2 sec
( I double checked these numbers. )
Jacek.