From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Nicolas =?UTF-8?Q?B=C3=A9rtolo?= Newsgroups: gmane.emacs.bugs Subject: bug#41242: Port feature/native-comp to Windows - Reduce the number of files probed when finding a lisp file. Date: Sun, 31 May 2020 19:41:36 -0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="109675"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 41242@debbugs.gnu.org To: Andrea Corallo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 01 00:42:22 2020 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 1jfWes-000SRP-8L for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Jun 2020 00:42:22 +0200 Original-Received: from localhost ([::1]:54602 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfWeq-0007FY-Sj for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 31 May 2020 18:42:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfWeY-0007FP-2H for bug-gnu-emacs@gnu.org; Sun, 31 May 2020 18:42:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:50736) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jfWeX-0007jH-O8 for bug-gnu-emacs@gnu.org; Sun, 31 May 2020 18:42:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jfWeX-0001jm-K8 for bug-gnu-emacs@gnu.org; Sun, 31 May 2020 18:42:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Nicolas =?UTF-8?Q?B=C3=A9rtolo?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 May 2020 22:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41242 X-GNU-PR-Package: emacs Original-Received: via spool by 41242-submit@debbugs.gnu.org id=B41242.15909649166668 (code B ref 41242); Sun, 31 May 2020 22:42:01 +0000 Original-Received: (at 41242) by debbugs.gnu.org; 31 May 2020 22:41:56 +0000 Original-Received: from localhost ([127.0.0.1]:34049 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jfWeS-0001jT-2x for submit@debbugs.gnu.org; Sun, 31 May 2020 18:41:56 -0400 Original-Received: from mail-ot1-f54.google.com ([209.85.210.54]:36398) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jfWeQ-0001jG-Lq for 41242@debbugs.gnu.org; Sun, 31 May 2020 18:41:55 -0400 Original-Received: by mail-ot1-f54.google.com with SMTP id h7so6526856otr.3 for <41242@debbugs.gnu.org>; Sun, 31 May 2020 15:41:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JrNSJsWFngBmI9pyL5/qLtnu0Z/vKHliSqDUlKb2XTk=; b=aQFky6x6yJctpskLtcvr0OFI1VWNkc0a/NaaxNCrsEO2hEEHHI4EWUlGZXDmU2ww+3 E4xO02lk/j3+gAzR4nRZsCzmw2+g5hov4JQ3GVN+eGb4b6I6IWTA7v9xSvb4zwmAXuf/ QJJS0AEZm4Zql5EijgDnlytypd9p4Lm7ly8IJbIZUBApIItlqprEkqJM8yEB6liDb1lN O0kW5Ci09pug7NwjRgDKap6iKLZUsFSFmV8sHJRGDYbu30ZYxxhKKev6e3j+cxCNUGW2 UnfSWrmmxwljfAZZpEuAS5IwtJTdK8WYwEOgMURtaRbzSmIhC7B9CdjJWSt6D7fkxtWB E3eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JrNSJsWFngBmI9pyL5/qLtnu0Z/vKHliSqDUlKb2XTk=; b=QHhH0n/kTszdlWF3csu0U4NdHQhiOAGxUCWGLTDsKw4Co2m+RVRfgIPjmOktnbnxVo XrRJcDDfU4upCfNMdKGMncjhQSEEheizjni0Ne+jXA5j4mG1KLSKiPSQJDEkRwuolThM pMe00NLYGXpdX4+nmW9WYeG1Ir2q3RG+jrKnbGcH5tLr5GJXtyvguBnPrO8FmtzJ65Ls RIT7/hiW9HasJpyn0yaX3bRIPy/fVqR6LyAA+nzPu8lj2/rsqJjuv7oI7qp6xtttoX31 SFIes6JYvQez8pXJOG96cjQQILILgvD+4oz++XrvgwKc4sSubpg2e3DKjPpq8fbCuZzC bPcQ== X-Gm-Message-State: AOAM530Lgmv35cHsLiM/AoxXdAFq+N/Oiz5TllLG5uXHI1twP4ZovSlE Z69yjjIhR1Wo9LJupsVlKAjiAXexqS6Ly1oT8vc= X-Google-Smtp-Source: ABdhPJzTnRhP8uV3z65RgEEkNtFjlOXrXNQYrwLvMsfV6U42hCqLkb/cjQRt6fx9wNVdn2Qh015ctEU+6v4lkmYzbhY= X-Received: by 2002:a9d:5f09:: with SMTP id f9mr14454449oti.202.1590964908918; Sun, 31 May 2020 15:41:48 -0700 (PDT) In-Reply-To: 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" Xref: news.gmane.io gmane.emacs.bugs:181324 Archived-At: Last night I came up with a fresh idea to properly solve the problem with slow loads. Considering that it happens when `load-path` contains hundreds of directories I thought that a caching mechanism would help. This "cache" would consist of a mapping of files that would get probed when (load "foo") runs. It would be implemented as a hash table. This could get stored in `package-user-dir` and package.el would be in charge of updating it when installing or removing packages, just like autoloads. The contents of this hash table could be something like this: The directory company-20200525.101 could have a file load-cache.el with: company -> ("company-20200525.101/eln-hash/company.eln" "company-20200525.101/company.el" "company-20200525.101/company.elc") [...] The directory helm-20200517.509 could have a file load-cache.el with: helm -> ("helm-20200517.509/eln-hash/helm.eln" "helm-20200517.509/helm.el" "helm-20200517.509/helm.elc") [...] When `load-path` changes we could update the in-memory hash table by loading all the load-cache.el files. Then, when (require 'foo) runs, the loading code could look at the hash table and only fopen() the files associated with the feature we are loading. This would reduce the number of calls to fopen() from thousands to ~3 in the worst case. Of course, this feature would be disabled by default. What do you think?