aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lispref/functions.texi15
1 files changed, 10 insertions, 5 deletions
diff --git a/lispref/functions.texi b/lispref/functions.texi
index 045aa454c9c..eedfa8c124f 100644
--- a/lispref/functions.texi
+++ b/lispref/functions.texi
@@ -1193,17 +1193,22 @@ function except for one thing: when you compile a call to the function,
1193the function's definition is open-coded into the caller. 1193the function's definition is open-coded into the caller.
1194 1194
1195Making a function inline makes explicit calls run faster. But it also 1195Making a function inline makes explicit calls run faster. But it also
1196has disadvantages. For one thing, it reduces flexibility; if you change 1196has disadvantages. For one thing, it reduces flexibility; if you
1197the definition of the function, calls already inlined still use the old 1197change the definition of the function, calls already inlined still use
1198definition until you recompile them. Since the flexibility of 1198the old definition until you recompile them.
1199redefining functions is an important feature of Emacs, you should not
1200make a function inline unless its speed is really crucial.
1201 1199
1202Another disadvantage is that making a large function inline can increase 1200Another disadvantage is that making a large function inline can increase
1203the size of compiled code both in files and in memory. Since the speed 1201the size of compiled code both in files and in memory. Since the speed
1204advantage of inline functions is greatest for small functions, you 1202advantage of inline functions is greatest for small functions, you
1205generally should not make large functions inline. 1203generally should not make large functions inline.
1206 1204
1205Also, inline functions do not behave well with respect to debugging,
1206tracing, and advising (@pxref{Advising Functions}). Since ease of
1207debugging and the flexibility of redefining functions are important
1208features of Emacs, you should not make a function inline, even if it's
1209small, unless its speed is really crucial, and you've timed the code
1210to verify that using @code{defun} actually has performance problems.
1211
1207It's possible to define a macro to expand into the same code that an 1212It's possible to define a macro to expand into the same code that an
1208inline function would execute. (@xref{Macros}.) But the macro would be 1213inline function would execute. (@xref{Macros}.) But the macro would be
1209limited to direct use in expressions---a macro cannot be called with 1214limited to direct use in expressions---a macro cannot be called with