aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGemini Lasswell2019-08-03 12:33:20 -0700
committerGemini Lasswell2019-09-13 13:43:07 -0700
commit6eaf39d21b70802e6bc607ee2fc2fff67b79231a (patch)
tree88d93b6bfffd2cf5a0d0f62c48ea8ed17d61a6fb
parent5c40c21a47062782bc983f41e8eeb97180dca693 (diff)
downloademacs-6eaf39d21b70802e6bc607ee2fc2fff67b79231a.tar.gz
emacs-6eaf39d21b70802e6bc607ee2fc2fff67b79231a.zip
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.
-rw-r--r--src/print.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/print.c b/src/print.c
index 7c3da68fc98..18330b0fbf4 100644
--- a/src/print.c
+++ b/src/print.c
@@ -81,7 +81,7 @@ static ptrdiff_t print_buffer_pos_byte;
81 -N the object will be printed several times and will take number N. 81 -N the object will be printed several times and will take number N.
82 N the object has been printed so we can refer to it as #N#. 82 N the object has been printed so we can refer to it as #N#.
83 print_number_index holds the largest N already used. 83 print_number_index holds the largest N already used.
84 N has to be striclty larger than 0 since we need to distinguish -N. */ 84 N has to be strictly larger than 0 since we need to distinguish -N. */
85static ptrdiff_t print_number_index; 85static ptrdiff_t print_number_index;
86static void print_interval (INTERVAL interval, Lisp_Object printcharfun); 86static void print_interval (INTERVAL interval, Lisp_Object printcharfun);
87 87
@@ -1149,7 +1149,11 @@ print (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
1149} 1149}
1150 1150
1151#define PRINT_CIRCLE_CANDIDATE_P(obj) \ 1151#define PRINT_CIRCLE_CANDIDATE_P(obj) \
1152 (STRINGP (obj) || CONSP (obj) \ 1152 ((STRINGP (obj) \
1153 && (string_intervals (obj) \
1154 || print_depth > 1 \
1155 || Vprint_continuous_numbering)) \
1156 || CONSP (obj) \
1153 || (VECTORLIKEP (obj) \ 1157 || (VECTORLIKEP (obj) \
1154 && (VECTORP (obj) || COMPILEDP (obj) \ 1158 && (VECTORP (obj) || COMPILEDP (obj) \
1155 || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj) \ 1159 || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj) \