Hello I don't think any second thread is involved here. I would have suspected some sort of the compile-time optimization here. I believe compiler may have figured out what is final value of "r" with no real loop implementation in the binary code. for(long int i=0; i<100000000; i++) { r += 0.5; } I mean the method above is not correct to measure the performance One should take care to break the possible optimization first. Valeri > > Hi Thomas, > > I can indeed reproduce the same slowdown by a factor of 2. I suspect that > this is due to the multi-thread nature of the ROOT implementation on > Windows. (I.e. the other thread are probably being run). We will > check further. > > Cheers, > Philippe. > > -----Original Message----- > From: owner-roottalk@pcroot.cern.ch > [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Thomas Nisius > Sent: Friday, August 08, 2003 7:28 AM > To: roottalk@pcroot.cern.ch > Subject: [ROOT] execution speed of compiled programs using ROOT > > > Hi, > > when I compile a program that include some root objects, execution speed > drops significantly. > please see the following example: > > #include <time.h> > #include <iostream> > using namespace std; > > #include <TH2D.h> > #define USE_ROOT > > int main(int argc, char* argv[]) { > > #ifdef USE_ROOT > TH2D *h = new TH2D("test","test",64,0,1,64,0,1); > h->FillRandom("gaus",1000); > #endif > > double r=0; > double time = clock(); // save the clock > for(long int i=0; i<100000000; i++) { > r += 0.5; > } > cout << r << endl; > cout << "Duration: " << clock() - time << endl; > return 0; > } > > if in this example 'USE_ROOT' is defined the duration is nearly twice as > long as without it. > (note, that only the execution of the loop is taken into account, not the > histo filling) > > I'm using Root 3.05/07 (win32gdk-version) on WinXP & Win2000 > Compiler: MSVC++ 6 > I link libCore.lib and libHist.lib to my Project > > Any suggestions? > > Kind Regards > Thomas Nisius > ________________________________________________________________________ __ > Die sicherste Form der Kommunikation: E-Mails verschluesseln, Spam-Filter, > Adressverifizierung, digitale Unterschrift: http://freemail.web.de
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET