| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (10 out of 14)

Comparing Method, Procedure, and Function Calls

This test compares the efficiency of calling procedures, methods, and functions, with physical inline statements, procedure inlining, and stability declarations. For this test, you create a function, a procedure, and a method, all with one argument of type test-object, which all return the value true. The test compares the following statements:

The recorded times include the time spent in both the calling procedure and the procedure, method, or function called.

Call Type Microseconds
physically inline
1.2
function
15.2
procedure call
45.1
method call
56.1
procedure call, with stability
36.0
procedure call, with stability and inlineable
2.4

Function and procedure calls introduce a very significant penalty. Inline declarations offer marked performance improvement, while stability declarations offer a slight improvement.

Stability declarations, when declared on a class by using stable-hierarchy, stable-for-dependent-compilations, have no discernible effect on method calling efficiency. Similarly, stability declarations have no effect on function calling efficiency.

Thus, for maximum efficiency, you should always use inlining when calling procedures.

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (10 out of 14)

Copyright © 1997 Gensym Corporation, Inc.