Thread: C++ questions
View Single Post
  #3  
Old 01-13-2005, 01:23 PM
Branks
Sarnak
 
Join Date: May 2004
Posts: 58
Default

i understand these questions are rather rediculous and petty but in my opinion its something that should be in the back of your mind at all times, so thats why i ask, and i know a profiler is the only real answer to some of them and that the answer varries between different machines.

im not really trying to optimize little syntaxtical things, its that no matter what compiler your using there are situations syntax prevents the compiler from being able to do any optimization, and thats parts of what im unsure of, i know inline is only a suggestion however ive also read its almost 100% impossible for a compiler to inline a virtual function, and a compiler cannot unroll a variable loop, so i was hoping we maybe had a hardcore assembly guru around who could say " i found loop setup time to be slower than 100 conditional checks", so i could keep that in mind and simply let a loop go 100 passes when it would sometimes only need 50, so that the compiler could unroll it.

in the case of GetAA() its called often enough i think inlining it would to benificial in any case since theres maybe 4 times ive found its called within Mob() scope.

the functions pointer thing, i know when calling functions it has to throw all currently used variables temporarily to the stack, or wherever it saves them so i was curious if function pointers made it do this as well, since thats a small but also needless thing to have 3 copies or so of variables around and i would know to prevent having a lot of arguements/parameters when using function pointers.

anyway, ill check into this vtune thing, never heard of it before, and thanks for the advice, im just trying to establish the commonly know performance mistakes, not trying to optimize really but these small things add up quickly.

also, the question about static variables declared within a class method, are these created for every instance of a class or does every instance of a class use the same method and therefor the static variables only exsist once?
Reply With Quote