From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: byte-compiler very slow Date: Tue, 23 Jul 2002 21:25:09 -0600 (MDT) Sender: emacs-devel-admin@gnu.org Message-ID: <200207240325.g6O3P9l04830@aztec.santafe.edu> References: <3D39C79B.6020605@dponce.com> <200207212015.g6LKFgA00958@aztec.santafe.edu> <1027284727.5453.5.camel@space-ghost> <200207221519.g6MFJnK02311@aztec.santafe.edu> <3D3D46DA.9040700@dponce.com> Reply-To: rms@gnu.org NNTP-Posting-Host: localhost.gmane.org X-Trace: main.gmane.org 1027481227 13009 127.0.0.1 (24 Jul 2002 03:27:07 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 24 Jul 2002 03:27:07 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17XCnn-0003NT-00 for ; Wed, 24 Jul 2002 05:27:03 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 17XD2P-0007K1-00 for ; Wed, 24 Jul 2002 05:42:10 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17XCo0-000769-00; Tue, 23 Jul 2002 23:27:16 -0400 Original-Received: from pele.santafe.edu ([192.12.12.119]) by fencepost.gnu.org with esmtp (Exim 3.35 #1 (Debian)) id 17XClz-0006k3-00; Tue, 23 Jul 2002 23:25:11 -0400 Original-Received: from aztec.santafe.edu (aztec [192.12.12.49]) by pele.santafe.edu (8.11.6+Sun/8.11.6) with ESMTP id g6O3PGB12336; Tue, 23 Jul 2002 21:25:16 -0600 (MDT) Original-Received: (from rms@localhost) by aztec.santafe.edu (8.10.2+Sun/8.9.3) id g6O3P9l04830; Tue, 23 Jul 2002 21:25:09 -0600 (MDT) X-Authentication-Warning: aztec.santafe.edu: rms set sender to rms@aztec using -f Original-To: david@dponce.com In-Reply-To: <3D3D46DA.9040700@dponce.com> (message from David Ponce on Tue, 23 Jul 2002 14:06:50 +0200) Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:6003 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:6003 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