# HG changeset patch # User aidan # Date 1180206020 0 # Node ID 53260b0cd16b2e8e25372cb6a99da7b32509523a # Parent 1227374e7199168392b957c94d897f4c165296c1 [xemacs-hg @ 2007-05-26 19:00:16 by aidan] Small speed improvement to eval, from Sebastian Freundt. diff -r 1227374e7199 -r 53260b0cd16b src/ChangeLog --- a/src/ChangeLog Sat May 26 18:28:23 2007 +0000 +++ b/src/ChangeLog Sat May 26 19:00:20 2007 +0000 @@ -1,3 +1,11 @@ +2007-05-24 Aidan Kehoe + + * eval.c (Feval): + Small optimisations from Sebastian Freundt's SXEmacs work; don't + do the unnecessary book-keeping in the trivial cases, only look + for an indirect function if the stored function is a bound + symbol. + 2007-05-24 Aidan Kehoe * free-hook.c (check_free): diff -r 1227374e7199 -r 53260b0cd16b src/eval.c --- a/src/eval.c Sat May 26 18:28:23 2007 +0000 +++ b/src/eval.c Sat May 26 19:00:20 2007 +0000 @@ -3539,6 +3539,16 @@ check_proper_critical_section_lisp_protection (); #endif + if (!CONSP (form)) + { + if (SYMBOLP (form)) + { + return Fsymbol_value (form); + } + + return form; + } + /* I think this is a pretty safe place to call Lisp code, don't you? */ while (!in_warnings && !NILP (Vpending_warnings) /* well, perhaps not so safe after all! */ @@ -3571,14 +3581,6 @@ unbind_to (speccount); } - if (!CONSP (form)) - { - if (SYMBOLP (form)) - return Fsymbol_value (form); - else - return form; - } - QUIT; if (need_to_garbage_collect) { @@ -3622,7 +3624,13 @@ /* At this point, only original_fun and original_args have values that will be used below. */ retry: - fun = indirect_function (original_fun, 1); + /* Optimise for no indirection. */ + fun = original_fun; + if (SYMBOLP (fun) && !EQ (fun, Qunbound) + && (fun = XSYMBOL (fun)->function, SYMBOLP (fun))) + { + fun = indirect_function(original_fun, 1); + } if (SUBRP (fun)) {