From eabcbe14aa41a4762c70e772f2bb751a147ec971 Mon Sep 17 00:00:00 2001
From: rtoy <rtoy>
Date: Thu, 27 Jan 2011 00:49:32 +0000
Subject: [PATCH] Micro optimization:  In SET-CMT-ENTRY, if the char-code is
 above attribute-table-limit and if the newvalue is #'read-token, we don't
 actually add the entry to the character-macro-hash-table, because that is the
 default value for the hash-table.  This helps to keep the hash-table size
 small.

---
 code/reader.lisp | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/code/reader.lisp b/code/reader.lisp
index fecf119a3..d9b7471b2 100644
--- a/code/reader.lisp
+++ b/code/reader.lisp
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/reader.lisp,v 1.67 2010/04/20 17:57:45 rtoy Rel $")
+  "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/reader.lisp,v 1.68 2011/01/27 00:49:32 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -275,8 +275,14 @@
 	(setf (elt (the simple-vector (character-macro-table rt))
 		   code)
 	      (coerce newvalue 'function))
-	(setf (gethash code (character-macro-hash-table rt))
-	      (coerce newvalue 'function)))))
+	(let ((f (coerce newvalue 'function)))
+	  ;; Don't add an entry if the function would be the same as
+	  ;; the default.  This needs to be coordinated with
+	  ;; GET-CMT-ENTRY above.
+	  (if (eq f #'read-token)
+	      f
+	      (setf (gethash code (character-macro-hash-table rt))
+		    f))))))
 
 (defun undefined-macro-char (stream char)
   (unless *read-suppress*
-- 
GitLab