|
From: Roger H. <rog...@mi...> - 2007-03-27 14:44:13
|
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.
I also changed e3view_submit_retained_render and E3Object_IsType to
use the fast version as they too do not check for NULL and uses a lot
of CPU time calling OpaqueTQ3Object::GetClass.
If nobody objects, the changes are:
In E3View.c in e3view_submit_retained_render
E3Root* theClass = (E3Root*) theObject->FastGetClass () ;
In E3Main.c in E3Object_IsType
return theObject->FastGetClass ()->IsType ( theType ) ;
In E3Grroup.c in e3group_submit_render
E3GroupInfo* groupClass = (E3GroupInfo*) theObject->FastGetClass () ;
In E3Main.h in struct OpaqueTQ3Object just after the definition of
GetClass
E3ClassInfoPtr FastGetClass ( void ) { return theClass ; }
Roger.
|