< Previous | Contents | Next >

Inlining Functions

Theres a small performance cost associated with calling a function. Normally, this isnt a big deal because the cost is relatively minor. However, for tiny functions (such as one or two lines), its sometimes possible to speed up program performance by inlining them. By inlining a function, you ask the compiler to make a copy of the function everywhere its called. As a result, program control doesnt have to jump to a different location each time the function is called.


 

Introducing the Taking Damage ProgramSpecifying Functions for InliningCalling Inlined Functions