inline
Syntax
Avoid the overhead of a method call for small, frequently called methods by marking them with the inline directive.
TSomeClass = class
public
  procedure DoSomething; inline;
end;
Notes
  • The inline keyword should be used sparingly after you have identified performance bottlenecks using a profiler and when there is a measurable performance improvement from doing so. Anything else is premature optimisation which as we all know rarely works the way you expect it to.
  • The compiler reserves the right to ignore your use of inline if it thinks you're being stupid.
  • The {$INLINE <ON|OFF|AUTO>} compiler directive (which defaults to ON) can be set to OFF to disable all inlining or AUTO to tell the compiler to automatically inline any small routines it thinks are good candidates. The AUTO setting should be used with care as it may result in a bloat of executable size.
Further reading
Andreas Hausladen discusses how the inlined CharInSet in D2009 is not as fast as it could be.
http://andy.jgknet.de/blog/2009/01/idea-for-charinset/
StackOverflow discussion of the compiler warning ""H2443 Inline function 'DeleteFile' has not been expanded because unit 'Windows' is not specified in USES list"
http://stackoverflow.com/questions/649704/compiler-hint-inline-function-has-not-been-expanded
StackOverflow discussion illustrating through disassembly that inlining recursive methods does not work.
http://stackoverflow.com/questions/723309/how-does-the-delphi-2009-compiler-handle-recursive-inline-methods
StackOverflow discussion on why assembly functions are not inlined.
http://stackoverflow.com/questions/2414964/why-delphi-compiler-does-not-inline-assembly-functions
StackOverflow discussion on how to tell if a method is going to be inlined.
http://stackoverflow.com/questions/5030740/how-do-i-know-if-a-delphi-function-is-going-to-be-inlined