emacs-devel
[Top][All Lists]
Advanced

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

Re: Building Emacs overflowed pure space


From: YAMAMOTO Mitsuharu
Subject: Re: Building Emacs overflowed pure space
Date: Wed, 19 Jul 2006 18:46:44 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/22.0.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Wed, 19 Jul 2006 18:22:44 +0900, YAMAMOTO Mitsuharu <address@hidden> 
>>>>> said:

>   Dumped with dolist in subr.el: 1209808 bytes used
>               dolist in cl.el:  >1211000 bytes used (overflow)
>               dolist in cl.el with the modification
>                 '--cl-dolist-temp-- -> '--dolist-temp-- :
>                                  1209832 bytes used

Sorry, I should have not used quote for uninterned symbols.  I meant
`dolist in cl-macs.el with the modification "--cl-dolist-temp--" ->
"--dolist-temp--"'.

BTW, I noticed some inefficiency of dolist in subr.el:

(defmacro dolist (spec &rest body)
  "Loop over a list.
Evaluate BODY with VAR bound to each car from LIST, in turn.
Then evaluate RESULT to get return value, default nil.

\(fn (VAR LIST [RESULT]) BODY...)"
  (declare (indent 1) (debug ((symbolp form &optional form) body)))
  (let ((temp (make-symbol "--dolist-temp--")))
    `(let ((,temp ,(nth 1 spec))
           ,(car spec))
       (while ,temp
         (setq ,(car spec) (car ,temp))
         (setq ,temp (cdr ,temp))
         ,@body)
       ,@(if (cdr (cdr spec))
             `((setq ,(car spec) nil) ,@(cdr (cdr spec)))))))

In the above definition, `(setq ,temp (cdr ,temp))' is not placed at
the end of the loop body, so it disables the following optimization in
byte-opt.el:

              ;; X: varref-Y    ...     varset-Y goto-X  -->
              ;; X: varref-Y Z: ... dup varset-Y goto-Z
              ;; (varset-X goto-BACK, BACK: varref-X --> copy the varref down.)
              ;; (This is so usual for while loops that it is worth handling).

Is it OK to place `(setq ...)' after `,@body' as in the CL-version?

                                     YAMAMOTO Mitsuharu
                                address@hidden




reply via email to

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