Commit 0b3a0f30 authored by Ken Raeburn's avatar Ken Raeburn

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
parent 63ec338c
......@@ -3414,6 +3414,13 @@ substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Obj
if (EQ (placeholder, subtree))
return object;
/* For common object types that can't contain other objects, don't
bother looking them up; we're done. */
if (SYMBOLP (subtree)
|| (STRINGP (subtree) && !string_intervals (subtree))
|| NUMBERP (subtree))
return subtree;
/* If we've been to this node before, don't explore it again. */
if (!EQ (Qnil, Fmemq (subtree, seen_list)))
return subtree;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment