emacs-devel
[Top][All Lists]
Advanced

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

Re: byte-compiler very slow


From: Richard Stallman
Subject: Re: byte-compiler very slow
Date: Tue, 23 Jul 2002 21:25:09 -0600 (MDT)

Thanks for tracking down the slowness in byte-compile-cl-warn.  With
that information it was not hard for me to speed up the test.  Please
try this.


*** bytecomp.el.~2.106.~        Sat Jul 20 18:01:19 2002
--- bytecomp.el Tue Jul 23 21:47:01 2002
***************
*** 957,962 ****
--- 957,963 ----
  ;; Also log the current function and file if not already done.
  (defun byte-compile-log-warning (string &optional fill level)
    (let ((warning-prefix-function 'byte-compile-warning-prefix)
+       (warning-group-format "")
        (warning-fill-prefix (if fill "    ")))
      (display-warning 'bytecomp string level "*Compile-Log*")))
  
***************
*** 1201,1223 ****
                    (delq calls byte-compile-unresolved-functions)))))
        )))
  
  (defun byte-compile-cl-warn (form)
    "Warn if FORM is a call of a function from the CL package."
!   (let* ((func (car-safe form))
!        (library
!         (if func
!             (cond ((eq (car-safe func) 'autoload)
!                    (nth 1 func))
!                   ((symbol-file func))))))
!     (if (and library
!            (string-match "^cl\\>" library)
             ;; Aliases which won't have been expended at this point.
             ;; These aren't all aliases of subrs, so not trivial to
             ;; avoid hardwiring the list.
             (not (memq func
                        '(cl-block-wrapper cl-block-throw
                          multiple-value-call nth-value
!                         copy-seq first second rest endp cl-member))))
        (byte-compile-warn "Function `%s' from cl package called at runtime"
                           func)))
    form)
--- 1202,1240 ----
                    (delq calls byte-compile-unresolved-functions)))))
        )))
  
+ (defvar byte-compile-cl-functions nil
+   "List of functions defined in CL.")
+ 
+ (defun byte-compile-find-cl-functions ()
+   (unless byte-compile-cl-functions
+     (dolist (elt load-history)
+       (when (string-match "^cl\\>" (car elt))
+       (setq byte-compile-cl-functions
+             (append byte-compile-cl-functions
+                     (cdr elt)))))
+     (let ((tail byte-compile-cl-functions))
+       (while tail
+       (if (and (consp (car tail))
+                (eq (car (car tail)) 'autoload))
+           (setcar tail (cdr (car tail))))
+       (setq tail (cdr tail))))))
+ 
  (defun byte-compile-cl-warn (form)
    "Warn if FORM is a call of a function from the CL package."
!   (let ((func (car-safe form)))
!     (if (and byte-compile-cl-functions
!            (memq func byte-compile-cl-functions)
             ;; Aliases which won't have been expended at this point.
             ;; These aren't all aliases of subrs, so not trivial to
             ;; avoid hardwiring the list.
             (not (memq func
                        '(cl-block-wrapper cl-block-throw
                          multiple-value-call nth-value
!                         copy-seq first second rest endp cl-member
!                         ;; This is sometimes defined in CL
!                         ;; but that redefines a standard function,
!                         ;; so don't warn about it.
!                         macroexpand))))
        (byte-compile-warn "Function `%s' from cl package called at runtime"
                           func)))
    form)
***************
*** 1317,1322 ****
--- 1334,1340 ----
    `(let (warning-series)
       ;; Log the file name.  Record position of that text.
       (setq warning-series (byte-compile-log-file))
+      (byte-compile-find-cl-functions)
       (let ((--displaying-byte-compile-warnings-fn (lambda ()
                                                    ,@body)))
         (if byte-compile-debug



reply via email to

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