Changeset 12412


Ignore:
Timestamp:
02/01/10 22:14:07 (12 years ago)
Author:
ehuelsmann
Message:

Make format.lisp a lot more memory-efficient by replacing an array

of size CHAR-CODE-LIMIT with a hash table.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/format.lisp

    r11784 r12412  
    298298
    299299(defvar *format-directive-expanders*
    300   (make-array char-code-limit :initial-element nil))
     300  (make-hash-table :test #'eq))
    301301(defvar *format-directive-interpreters*
    302   (make-array char-code-limit :initial-element nil))
     302  (make-hash-table :test #'eq))
    303303
    304304(defvar *default-format-error-control-string* nil)
     
    595595    (format-directive
    596596     (let ((expander
    597       (aref *format-directive-expanders*
    598       (char-code (format-directive-character directive))))
     597      (gethash (format-directive-character directive)
     598                     *format-directive-expanders*))
    599599     (*default-format-error-offset*
    600600      (1- (format-directive-end directive))))
     
    712712
    713713  (defun %set-format-directive-expander (char fn)
    714     (setf (aref *format-directive-expanders* (char-code (char-upcase char))) fn)
     714    (setf (gethash (char-upcase char) *format-directive-expanders*) fn)
    715715    char)
    716716
    717717  (defun %set-format-directive-interpreter (char fn)
    718     (setf (aref *format-directive-interpreters*
    719                 (char-code (char-upcase char)))
    720           fn)
     718    (setf (gethash (char-upcase char) *format-directive-interpreters*) fn)
    721719    char)
    722720
     
    17641762             (let* ((character (format-directive-character directive))
    17651763                    (function
    1766                      (svref *format-directive-interpreters*
    1767                             (char-code character)))
     1764                     (gethash character *format-directive-interpreters*))
    17681765                    (*default-format-error-offset*
    17691766                     (1- (format-directive-end directive))))
Note: See TracChangeset for help on using the changeset viewer.