From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.bugs Subject: bug#19390: 25.0.50; `package-activate' is too slow Date: Tue, 16 Dec 2014 11:42:09 -0200 Message-ID: References: <86a92oddfp.fsf@yandex.ru> <86mw6nkc6n.fsf@yandex.ru> Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1418737410 22564 80.91.229.3 (16 Dec 2014 13:43:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Dec 2014 13:43:30 +0000 (UTC) Cc: 19390@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Dec 16 14:43:23 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Y0sPG-0005kX-TS for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Dec 2014 14:43:19 +0100 Original-Received: from localhost ([::1]:44863 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0sPG-0004Nz-BG for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Dec 2014 08:43:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0sP6-0004Ne-Iw for bug-gnu-emacs@gnu.org; Tue, 16 Dec 2014 08:43:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0sP0-00060U-95 for bug-gnu-emacs@gnu.org; Tue, 16 Dec 2014 08:43:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38216) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0sP0-00060Q-5z for bug-gnu-emacs@gnu.org; Tue, 16 Dec 2014 08:43:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Y0sOz-0008Ep-PV for bug-gnu-emacs@gnu.org; Tue, 16 Dec 2014 08:43:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Artur Malabarba Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Dec 2014 13:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19390 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 19390-submit@debbugs.gnu.org id=B19390.141873733331608 (code B ref 19390); Tue, 16 Dec 2014 13:43:01 +0000 Original-Received: (at 19390) by debbugs.gnu.org; 16 Dec 2014 13:42:13 +0000 Original-Received: from localhost ([127.0.0.1]:47582 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y0sOD-0008Dk-AA for submit@debbugs.gnu.org; Tue, 16 Dec 2014 08:42:13 -0500 Original-Received: from mail-oi0-f52.google.com ([209.85.218.52]:43499) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y0sOA-0008Da-8n for 19390@debbugs.gnu.org; Tue, 16 Dec 2014 08:42:10 -0500 Original-Received: by mail-oi0-f52.google.com with SMTP id h136so9497857oig.39 for <19390@debbugs.gnu.org>; Tue, 16 Dec 2014 05:42:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=nPuIAi22gn9zCoeZlhTEb1IVWIwAO7Y8n/4fBn2EQM4=; b=BkJSttv552CQKwmMLrXCY1uKBDbCR3h2SGjF6WTUzPT7jzZzEoDN/eRQppkBVx4wpG mzjsjVoZcTupRYncWrBhCfcbAkMXL8Ln355MRP5aqGmvMDgh0PQm9fETlptz/LWpLN8J zeZkUIV6qohm5s/BY48/LiR4tNLnUIvVawL8nt04e6ZLSEfHr8rTOCeqHiZNK1QFJc5B kjVaRzywFu7wYHUJH/N+ZkFWOwzRIbjjoLrMFPlDZ3ST+lU2zq8GRC7l0r9rFbfXyYrf X8ooHBnHlPyCm7mf1QIUBO6yfeDOCUa9/9bUC4lFt6JWf7MXdTjfChpBvjraCE3pldr4 dAgw== X-Received: by 10.182.102.161 with SMTP id fp1mr22543054obb.29.1418737329593; Tue, 16 Dec 2014 05:42:09 -0800 (PST) Original-Received: by 10.76.154.106 with HTTP; Tue, 16 Dec 2014 05:42:09 -0800 (PST) In-Reply-To: X-Google-Sender-Auth: dFRhMey3oAXwsB3iJ9Qi1nFhgEU X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:97380 Archived-At: As for low-hanging fruits in `package--list-loaded-files', there are two I can think of. 1. If `load-history' stored `file-truename's (relative to "/"), instead of just absolute file names, then that would avoid a lot of calls to `file-truename'. This, I suspect, is the bigger performance issue. 2. Creating the `history' variable as below is a problem. (mapcar (lambda (x) (file-name-sans-extension (file-truename (car x)))) load-history) This lambda is called a lot more times than necessary, because most entries in load-history are useless here. But we need to do this to be able to reliably compare file names. Ideally, there would be another variable, like `load-history-truename', which is modified in parellel with `load-history' and *only* stores the truename of files listed in `load-history' (no need to store all that extra information). Then we could just use this variable unmodified. Implementing 2. would also fix 1. 2014-12-16 11:26 GMT-02:00 Artur Malabarba : > I didn't notice anything as aggravating as the report, but I agree my > latest patch is a performance concern. > > The proposed patch looks good, just a couple of notes: > > 1. I'd use RELOAD for the name of the optional argument. > 2. Since this function now takes a second (somewhat non-trivial > argument), we should add a docstring to it: > > "Activate package given by PKG-DESC, even if it was already active. > If RELOAD is non-nil, also `load' any files inside the package which > correspond to previously loaded files (those returned by > `package--list-loaded-files'). > > This is called internally by `package-activate'."