[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] refs/scratch/raeburn/startup 98a2a33 3/5: Short-circuit su
From: |
Ken Raeburn |
Subject: |
[Emacs-diffs] refs/scratch/raeburn/startup 98a2a33 3/5: Short-circuit substitutions for some simple types. |
Date: |
Sun, 30 Oct 2016 14:16:47 +0000 (UTC) |
reference: refs/scratch/raeburn/startup
commit 98a2a3369f5e2848cf9feffaa275cb2d9b418ff2
Author: Ken Raeburn <address@hidden>
Commit: Ken Raeburn <address@hidden>
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.
---
src/lread.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/lread.c b/src/lread.c
index a06a78f..dec0df0 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3355,6 +3355,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;