|
From: James W. <ja...@fr...> - 2007-03-28 17:33:30
|
Roger Holmes wrote: > e3group_submit_render is used a great deal, recursing very deeply in > Microspot's applications, so Shark shows it, and the routines it > calls use a lot of CPU time. I have a couple of optimisations for it, > but lets keep it simple and do one at a time for now. It calls > OpaqueTQ3Object::GetClass, which (in the disassembled code)pushes a > register, checks that its 'this' pointer is NULL and sets the return > register to a field of 'this', or to NULL if 'this' was NULL, then > pops the register back off and actually returns. > > e3group_submit_render then ignores whether the return value was NULL > and dereferences it. > > An optimisation for this is to have an inline > OpaqueTQ3Object::FastGetClass which just returns the field of the > class. This avoids the register pop, the call, the test for NULL and > may allow e3group_submit_render to make better use of its registers, > which are somewhat more limited on Intel than they were on PowerPC. Is there any case in which it is not a bug for 'this' to be NULL? I can't find one. I suggest that instead of adding FastGetClass, we just change the implementation of OpaqueTQ3Object::GetClass to Q3_ASSERT( this != NULL ); return theClass; so that in non-debug builds it will just return theClass. Also GetClass could be made inline. -- James W. Walker, Innoventive Software LLC <http://www.frameforge3d.com/> |