diff src/eval.c @ 3989:53260b0cd16b

[xemacs-hg @ 2007-05-26 19:00:16 by aidan] Small speed improvement to eval, from Sebastian Freundt.
author aidan
date Sat, 26 May 2007 19:00:20 +0000
parents 1c2a46ea1f78
children f9a0570637f3
line wrap: on
line diff
--- 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))
     {