close Warning: Can't synchronize with repository "(default)" ("(default)" is not readable or not a Git repository.). Look in the Trac log for more information.

Opened 10 years ago

#107 new defect

dumping structs with make-load-form

Reported by: Helmut Eller Owned by: somebody
Priority: major Milestone:
Component: Core Version: 2014-09
Keywords: Cc:

Description

When dumping structs that have a custom make-load-form the resulting fasl file is very big. For example this:

(in-package cl-user)

(defstruct foo)

(defmethod make-load-form ((o foo) &optional env)
  (make-load-form-saving-slots o :environment env))

(defun test-dump (object)
  (let ((filename "/tmp/foo.lisp"))
    (with-open-file (out filename :direction :output :if-exists :supersede)
      (with-standard-io-syntax
        (format out "(defun dumped-object () '#.***)~%")))
     (load (let ((*** object))
             (compile-file filename)))
     (funcall 'dumped-object)))

(defun object-to-dump (size)
  (let ((x (make-array size)))
    (dotimes (i size)
      (setf (aref x i) (make-foo)))
    x))

(test-dump (object-to-dump 1000))

produces a /tmp/foo.sse2f that's about 1MB big. That's about 1 KB per object which seems very much. Maybe the layout and class are dumped for each struct object individually instead of being shared.

For comparision CCL only creates a 5 KB file and AllegroCL 25 KB. SBCL is also quite big: 650 KB.

This is not a big deal but maybe it's easy to fix.

Change History (0)

Note: See TracTickets for help on using tickets.