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 19:35:38 -0200 Message-ID: References: <86a92oddfp.fsf@yandex.ru> <86mw6nkc6n.fsf@yandex.ru> <54904241.8010000@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 1418765791 14695 80.91.229.3 (16 Dec 2014 21:36:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Dec 2014 21:36:31 +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 22:36: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 1Y0zmz-0005Pe-WE for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Dec 2014 22:36:18 +0100 Original-Received: from localhost ([::1]:46926 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0zmz-0001Qv-Hv for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Dec 2014 16:36:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0zmq-0001Ph-AG for bug-gnu-emacs@gnu.org; Tue, 16 Dec 2014 16:36:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y0zmk-00046R-5K for bug-gnu-emacs@gnu.org; Tue, 16 Dec 2014 16:36:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38837) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y0zmk-00046L-26 for bug-gnu-emacs@gnu.org; Tue, 16 Dec 2014 16:36:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Y0zmj-0000FN-Rx for bug-gnu-emacs@gnu.org; Tue, 16 Dec 2014 16:36: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 21:36: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.1418765743920 (code B ref 19390); Tue, 16 Dec 2014 21:36:01 +0000 Original-Received: (at 19390) by debbugs.gnu.org; 16 Dec 2014 21:35:43 +0000 Original-Received: from localhost ([127.0.0.1]:48203 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y0zmP-0000Ek-LD for submit@debbugs.gnu.org; Tue, 16 Dec 2014 16:35:43 -0500 Original-Received: from mail-ob0-f182.google.com ([209.85.214.182]:55096) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y0zmN-0000Ec-Ih for 19390@debbugs.gnu.org; Tue, 16 Dec 2014 16:35:40 -0500 Original-Received: by mail-ob0-f182.google.com with SMTP id wo20so670320obc.13 for <19390@debbugs.gnu.org>; Tue, 16 Dec 2014 13:35:38 -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=Rqkc1jqdFPFNnNmsd60Um+tD8ZT+NQDPnUqxIZiS5rA=; b=MQxztcZEUbrlpDt/+qKJQbVb42gbtaTMjCnavBljBzN0wjAtoeEZLdCFLoPpKspgu8 M8+pH2xJs71/nUnfr3aRHR9De/rEW+zQqVq0Sk13pJhwjqkkmUYA1Kdr6Xv+eOLT1KEJ jGLFuGQ5nhS/UTjrYUIyapcxZRI9nkjMBRL1dX7l73eoMNNknD4/XRkd0SAZ2oHg1+PO vU6IPOioYkL9xCGWPh6TuuxxD+1skW9M9EiqbQtlnJrTFVZcHKWbxWpo+gZ5N/JTgigM KG00EKcQPDcpkO/vh8P4rP5eqVm2WBzXWRW80Amvz5zGKpXXxe+FWASAVQjm/K8jgGNP 9m6w== X-Received: by 10.182.210.232 with SMTP id mx8mr24100830obc.46.1418765738811; Tue, 16 Dec 2014 13:35:38 -0800 (PST) Original-Received: by 10.76.154.106 with HTTP; Tue, 16 Dec 2014 13:35:38 -0800 (PST) In-Reply-To: <54904241.8010000@yandex.ru> X-Google-Sender-Auth: fSsdqvdnJXv1K-VZ4iULyB_RPRc 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:97412 Archived-At: 2014-12-16 12:31 GMT-02:00 Dmitry Gutov > On 12/16/2014, Artur Malabarba wrote: > >> I didn't notice anything as aggravating as the report, but I agree my >> latest patch is a performance concern. > > Do you maybe have fewer packages installed? Perhaps. But the reason is beyond the point, :-) I agree this patch needs performance improvements. > Any particular reason you're using file-truename', instead of >expand-file-name'? Replacing the former with the latter already gives > ~twofold performance improvement. Yes, I originally used `expand-file-name', but `package--list-loaded-files' would miss some files if there was a symlink in the path. (I specifically observed this, it's not just theory). The problem is that a file returned by `find-libary' could be the same as another file contained in `load-history' but have a different name (because of symlinks). >> 2. Creating the `history' variable as below is a problem. >> >> (mapcar (lambda (x) (file-name-sans-extension >> (file-truename (car x)))) >> load-history) > > > With the above change, this piece of code is relatively fast. > > For instance, (package--list-loaded-files default-directory) in the Helm > directory takes 140 ms here, whereas > > (mapcar (lambda (x) (file-name-sans-extension > (expand-file-name (car x)))) > load-history) > > only takes ~10 ms. Still not fast enough not to need the other patch, of > course. Yes, I agree `file-truename' is slow. The foolproof way would be to have a variable that stores the `file-truename's, so we wouldn't have to calculate them. Using `expand-file-name' is a valid way to improve performance here, but it won't *always* reload the files for all users.