Christian, By optimizing the class layout, I mean the following: Suppose a class like class MyClass { Int_t fI1; Double_t fD1; Short_t fS1; Bool_t fB1; Double_t fD2; Int_t fI2; Someclass *fSomec; Int_t fI3; etc This class has a bad layout for two reasons. - in memory, an instance will occupy more space than you think. All compilers have to align the member boundaries such that, eg fD2 starts at an 8byte boundary. - the I/O loops on all the cases with a penalyzing if for each case. If instead you do class MyClass { Double_t fD1; Double_t fD2; Int_t fI1; Int_t fI2; Int_t fI3; Short_t fS1; Bool_t fB1; Someclass *fsomec; The Root I/O optimizer in TStreamerInfo::Compile will be able to process fD1 and FD2 in one go, fI1,fI2,fI3 in one go, etc Rene Brun Christian Holm Christensen wrote: > > Hi Rene et al, > > On Thu, 01 Nov 2001 07:29:50 +0000 > Rene Brun <Rene.Brun@cern.ch> wrote > concerning "Re: [ROOT] How to accelerate root output?": > > Hi Victor, > > > > The new system may even be faster than the old one if you have a > > good class layout. I see so many cases where people mix ints with > > floats, doubles, etc ! > > Could you be a bit more specific? What do you mean by "good class > layout"? And how does "mix ints with floats, doubles, etc" penalise > you in terms of performance? Does this have anything to do with the > TClonesArray::BypassStreamer flag? Perhaps a few lines in the Users > Guide would be a good thing (I didn't actually check, but I can't > remember from past reading seeing anything on this - apologies if it's > already there). > > Am I to understand, that ones > classes should preferably have only one kind of (simple) members > (float, double, XOR, int)? If so, isn't it a bit archaic, in the > sense that it's something you'd do in Fortran77+ZEBRA? Thanks. > > Yours, > > Christian Holm Christensen ------------------------------------------- > Address: Sankt Hansgade 23, 1. th. Phone: (+45) 35 35 96 91 > DK-2200 Copenhagen N Cell: (+45) 28 82 16 23 > Denmark Office: (+45) 353 25 305 > Email: cholm@nbi.dk Web: www.nbi.dk/~cholm
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:05 MET