emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 6eaf39d 3/5: Fix unnecessary hash table creation in


From: Gemini Lasswell
Subject: [Emacs-diffs] master 6eaf39d 3/5: Fix unnecessary hash table creation in cl-prin1 (bug#36566)
Date: Fri, 13 Sep 2019 17:05:20 -0400 (EDT)

branch: master
commit 6eaf39d21b70802e6bc607ee2fc2fff67b79231a
Author: Gemini Lasswell <address@hidden>
Commit: Gemini Lasswell <address@hidden>

    Fix unnecessary hash table creation in cl-prin1 (bug#36566)
    
    cl-prin1 prints all its punctuation by passing strings to prin1.  When
    print-circle was set, print_preprocess was creating a new hash table
    for each string, causing excessive garbage collection when printing
    large Lisp objects with cl-prin1.
    
    * src/print.c (print_number_index): Fix typo in comment above.
    (PRINT_CIRCLE_CANDIDATE_P): Don't create print_number_table
    for top-level strings with no properties, except when
    print_continuous_numbering is on.
---
 src/print.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/print.c b/src/print.c
index 7c3da68..18330b0 100644
--- a/src/print.c
+++ b/src/print.c
@@ -81,7 +81,7 @@ static ptrdiff_t print_buffer_pos_byte;
      -N   the object will be printed several times and will take number N.
      N    the object has been printed so we can refer to it as #N#.
    print_number_index holds the largest N already used.
-   N has to be striclty larger than 0 since we need to distinguish -N.  */
+   N has to be strictly larger than 0 since we need to distinguish -N.  */
 static ptrdiff_t print_number_index;
 static void print_interval (INTERVAL interval, Lisp_Object printcharfun);
 
@@ -1149,7 +1149,11 @@ print (Lisp_Object obj, Lisp_Object printcharfun, bool 
escapeflag)
 }
 
 #define PRINT_CIRCLE_CANDIDATE_P(obj)                     \
-  (STRINGP (obj) || CONSP (obj)                                   \
+  ((STRINGP (obj)                                          \
+       && (string_intervals (obj)                          \
+         || print_depth > 1                               \
+         || Vprint_continuous_numbering))                 \
+   || CONSP (obj)                                         \
    || (VECTORLIKEP (obj)                                  \
        && (VECTORP (obj) || COMPILEDP (obj)               \
           || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj) \



reply via email to

[Prev in Thread] Current Thread [Next in Thread]