aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Raeburn2016-10-27 02:53:07 -0400
committerKen Raeburn2017-06-21 22:34:32 -0400
commit0b3a0f30b288945e739f1ac7c2f9d8a2fdd352ac (patch)
tree9b1d5022ed8b38bef02a1ed83c3b839e6a72a84b
parent63ec338c988f3ac661fd68591d688b3874c88511 (diff)
downloademacs-0b3a0f30b288945e739f1ac7c2f9d8a2fdd352ac.tar.gz
emacs-0b3a0f30b288945e739f1ac7c2f9d8a2fdd352ac.zip
Short-circuit substitutions for some simple types.
Values that don't contain other values cannot be circular, so checking for circular objects is a waste of cycles. * src/lread.c (substitute_object_recurse): If the subtree being examined is a symbol, number, or property-less string, just return it.
-rw-r--r--src/lread.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/lread.c b/src/lread.c
index f8493982c67..263638651db 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3414,6 +3414,13 @@ substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Obj
3414 if (EQ (placeholder, subtree)) 3414 if (EQ (placeholder, subtree))
3415 return object; 3415 return object;
3416 3416
3417 /* For common object types that can't contain other objects, don't
3418 bother looking them up; we're done. */
3419 if (SYMBOLP (subtree)
3420 || (STRINGP (subtree) && !string_intervals (subtree))
3421 || NUMBERP (subtree))
3422 return subtree;
3423
3417 /* If we've been to this node before, don't explore it again. */ 3424 /* If we've been to this node before, don't explore it again. */
3418 if (!EQ (Qnil, Fmemq (subtree, seen_list))) 3425 if (!EQ (Qnil, Fmemq (subtree, seen_list)))
3419 return subtree; 3426 return subtree;