next up previous

8.2 PERFORMANCE PENALTY OF GENERIC FUNCTIONS

A call to a generic function is computationally more expensive than a call to a system function, user-defined external function or deffunction. This is because CLIPS must first examine the function arguments to determine which method is applicable. A performance penalty of 15%20% is not unexpected. Thus, generic functions should not be used for routines for which time is critical, such as routines which are called within a while loop, if at all possible. Also, generic functions should always have at least two methods. Deffunctions or user-defined external functions should be used when overloading is not required. A system or user-defined external function which is not overloaded will, of course, execute as quickly as ever, since the generic dispatch is unnecessary.


next up previous