From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#41646: Startup in Windows is very slow when load-path contains many Date: Sun, 13 Oct 2024 11:51:05 -0400 Message-ID: References: <86jzedy84g.fsf@gnu.org> <86r08luqsq.fsf@gnu.org> <86frp1unvu.fsf@gnu.org> <86y12stv24.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30559"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 41646@debbugs.gnu.org, Eli Zaretskii , Andrea Corallo , Lin Sun , Stefan Monnier To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 13 17:52:13 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t00tB-0007nT-4i for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 13 Oct 2024 17:52:13 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t00sp-0001O8-4g; Sun, 13 Oct 2024 11:51:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t00sm-0001Nt-MB for bug-gnu-emacs@gnu.org; Sun, 13 Oct 2024 11:51:48 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t00sl-0002XH-2W for bug-gnu-emacs@gnu.org; Sun, 13 Oct 2024 11:51:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=k8H4anJkNrdULrPmuHqPZyDUp9fIqklhJCaDyN4Nng8=; b=hViUIUEoWaWK1HRKjpYHoClFjiI3QLB+T5EU1VI+ouFWdBNs8qFfjdMACTPcM+3yt1T2YZ0SaC6ARjpKdUX98i3E9RZwnM1m0Ndlx4lMzWoMG7qmyhBISsrBB/Fj8zid2ZkyfK2L32eyTNmmxOxpSISHwtO5MCDD+sicGXZBQEnAt2kLV1m+kFnj/OpYAZip/c2TMRIZV/lGyWDXmx6bdcy9ygOVQlfXzNjrhIlxSKaGn5QfY+fBTuIh6/jZrMFhF0w04VQVUB8bgG0IB0DUmuUHcnNgPoLih71CK3Y3BDn3dJ8lUd/8/InqFrzDWi0Pr7/7d+aQpLqzIal3+E+B2g==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t00t0-0002BB-KU for bug-gnu-emacs@gnu.org; Sun, 13 Oct 2024 11:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Oct 2024 15:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41646 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch fixed Original-Received: via spool by 41646-submit@debbugs.gnu.org id=B41646.17288346918331 (code B ref 41646); Sun, 13 Oct 2024 15:52:02 +0000 Original-Received: (at 41646) by debbugs.gnu.org; 13 Oct 2024 15:51:31 +0000 Original-Received: from localhost ([127.0.0.1]:52157 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t00sV-0002AJ-C4 for submit@debbugs.gnu.org; Sun, 13 Oct 2024 11:51:31 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:11629) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t00sT-0002A4-8A for 41646@debbugs.gnu.org; Sun, 13 Oct 2024 11:51:30 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 2919F100055; Sun, 13 Oct 2024 11:51:07 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1728834666; bh=5IBiy1OdCHi6tgV8yQe5BfeBIAXN9DZhpOjrhAcpRAQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=aeM3vHmBN90SSzPx9S0Ss8AjW3MqdXjH2dVkrNnRQyW7fPJAEltyE8+PpDwK9m3F6 Be/3sWBnoM809GlDwxusOfdXYSMF0jyascML6owlWfqBgkqpKnwG+jSNecJBiOAoSV aGtLoJbVSMeH2uUwM9p1wV37XPpj4Uq3oWu8adGbk7rjUWnsxUx5/eNhgpUhGmjkqQ U2TJRsXbnxBEgojW6z4wAYCAtvZBC0Tckt4IZu4ypE+NI7zErozt5Q2h5RP/mcSkjI yxm+BIO/rqg2HS0sqHcW6kS9CiPH6aTk/gbUBWQEpie7sTilUMAS7cAWTpi9nOuneX 6nh8Fw0j1lHKQ== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 56A97100042; Sun, 13 Oct 2024 11:51:06 -0400 (EDT) Original-Received: from pastel (104-195-209-82.cpe.teksavvy.com [104.195.209.82]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 17E281205EF; Sun, 13 Oct 2024 11:51:06 -0400 (EDT) In-Reply-To: (Stefan Kangas's message of "Sun, 13 Oct 2024 09:50:42 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:293533 Archived-At: > [I have unarchived Bug#41646 so that this discussion is archived in the > bug tracker.] [ Note: I haven't seen the earlier part of this discussion (but I did read the old bug#41646 thread). ] >> Totally understand, and thanks for inviting Stefan and Andrea in the >> conversation, to let new participants know the context quickly, I had >> post a patch to speed up Emacs for the scenario that Emacs will very >> slow on startup with hundreds packages (>300) installed, the keypoint >> is hundreds packages will add hundreds paths into the `load-path', >> then a simple `(require X)' may trigger hundreds searching according >> to the `load-path', Yup, that's a known problem which we've been not solving for a long time. The "latest" workaround is `package-quickstart`, which reduces some of the associated pain. If you're not using `package-quickstart` and are bothered by a slow startup, then I'd recommend you go back and enable `package-quickstart`. Similarly in the old bug#41646 thread, I see mentions of 40s startup time, 8s of which are *not* spent in openp: 8s is still quite slow, so it might be worth looking at what the startup file is doing and see if we could do less at startup (e.g. load things more lazily). Of course, the "long load-path" problem will still end up biting in some cases. Until now we've managed to make those cases rare enough that we haven't had to actually solve it. >> so the patch build a map for feature --> filepath from the variable >> `load-history' and store to disk, after that loading I don't think we want a cache that's stored on disk: it would take too much effort to create it, load it, ensure it's not damaged if several Emacs sessions try to write it at the same time, make sure it's fresh, etc... Especially since I believe that building the cache shouldn't take very long: longer than a single "look for file F in `load-path`", maybe, but not by much. IOW we could keep a cache that's populated on-the-fly the first time we `load` something, and that's then automatically refreshed when `load` sees a new `load-path`. Stefan