From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: 28.0.50; Proposal: slightly more efficient package-quickstart.el Date: Tue, 20 Jul 2021 02:27:26 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7715"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jul 20 02:28:11 2021 Return-path: Envelope-to: ged-emacs-devel@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 1m5dcI-0001kj-V2 for ged-emacs-devel@m.gmane-mx.org; Tue, 20 Jul 2021 02:28:11 +0200 Original-Received: from localhost ([::1]:38018 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5dcH-0000Y3-89 for ged-emacs-devel@m.gmane-mx.org; Mon, 19 Jul 2021 20:28:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54976) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5dbg-0008K0-7R for emacs-devel@gnu.org; Mon, 19 Jul 2021 20:27:32 -0400 Original-Received: from mail-vi1eur05olkn2038.outbound.protection.outlook.com ([40.92.90.38]:60513 helo=EUR05-VI1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5dbd-0003Ca-Up for emacs-devel@gnu.org; Mon, 19 Jul 2021 20:27:31 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n83RbK6+fmhVklAF4ISI6o0BWv5nekh5kLHPM3CfQ/zLJatl1IMnLSQt/zx2WV0Mcfv05yHUVnTUkqH++yeGbBaaSvzymez6d3fztMJO/bq8N2n+jumH6WgyKioUWBJsByzrphsWxsLsL35KcjHk/hmqWm8AS56atezztcV0/zYN1O3qTf/vbQ9ZH09hfuAjKWpp0aaqHd17fuLWYZI6gjrXXX8pLtOGCGoyXGzwDbcYiIdPduDt++qxQC45gpUeaD9SngxQBprzZtQl51tb4/2FqegZCnINzh9oolqCwI9TGd7Z4RH8726k2rJsx984QfXRbLck9hgfaUNCauJc9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I4vx8Sz691sMKqtdxDpMsgdETFIaAib9gymjiZS5Voo=; b=C1Ghad/HAokjYHSWdtWr6EnkgCZwnwoEm660FlO4+JwVl3kOwltFZO178x5doYegpd6hC0Eqq58tmJiElEB/WLg2saSCFt/+A6DV21VPT/jpoXH2n5fZ0JNylML3DQsi/R33Dn8g381GAmhbBrwP7TwPgT3LkJfd69IvjOaDjOalbCRclWoRmnmCCN+VMuc4SauWp6lP840//aZY1sksgPiv3fU1vOCCgCQFOCHv0/+C/mRG6c3JApkjTuO4IA+4fkDuhjwCp+T5e68AVm9vjCCY/5C3QIdhOs9kKS5WBiix4ZzNatfxC7cTJs3vq0p0MMCraYldiIfuOp7grkcxtQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=I4vx8Sz691sMKqtdxDpMsgdETFIaAib9gymjiZS5Voo=; b=Hcw4ZY00Y4ArveBmG8UgXu3vgtX4x4lOpc0p14oslBP7PRjQ41C5VBeo9WA4+kvDrYa6bO15tz9tSgwdI6nvyWlHo+NtlHAcjEc0KEF+3cSDs8EZMd+KAVDqjIGb+JEQHr8BmrMOuubWJkvUMKzaeVeM3x/mzbU9Y64T45kdgmJbAriUYYlpSnnOwwZS/e485NhqsR6kBE76Ubg0+IgLJ3jqLQs6vvDps/VUwz1XaQLd2oqwMRiMAX/dRO/E/RUwg+9f1yyIpMo35U6l004RQ9qZwSsMzsJGN/K1TV7eCzBQt0c4iURXHaCQ6G8MnAaWR9fdVSLs5aqK6SaTimwpUA== Original-Received: from AM6EUR05FT063.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc11::44) by AM6EUR05HT071.eop-eur05.prod.protection.outlook.com (2a01:111:e400:fc11::383) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21; Tue, 20 Jul 2021 00:27:27 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2a01:111:e400:fc11::43) by AM6EUR05FT063.mail.protection.outlook.com (2a01:111:e400:fc11::232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.21 via Frontend Transport; Tue, 20 Jul 2021 00:27:27 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:2D665EFDD12F2053DAC0D5F9821F52D03B1C5734AB0942AA151A33936A2CDD84; UpperCasedChecksum:93439AB41F618C72903DAB746992D91BF9C43006CB7C629EE05146D22D1F184E; SizeAsReceived:7227; Count:43 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::e47b:760e:fa35:f28b]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::e47b:760e:fa35:f28b%6]) with mapi id 15.20.4331.034; Tue, 20 Jul 2021 00:27:27 +0000 X-TMN: [uGocKv7QRjvajt8+1C2wHglGHPSLreHo] X-ClientProxiedBy: AM6P191CA0021.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:8b::34) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87czrd4yoh.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AM6P191CA0021.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:8b::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22 via Frontend Transport; Tue, 20 Jul 2021 00:27:26 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 43 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: a326f152-2bfa-4797-1255-08d94b1526f3 X-MS-TrafficTypeDiagnostic: AM6EUR05HT071: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P/66Ntor9+KP0VAaFMHvbct9eDSq4GyOiYOSC3QiuWXT3KoYqUkUQH+Hd0gP92fbL8YgZuR7JIWz9AxdgoyMlpDhppU4OhkA+9GQ1T4UkUM/SNAhwmo2UNnSF4QxqS6vmWRPUyMC+snLFcDaYNH9LXyQZdIaba0sU+7mTuoy+DgStTTfK00hQ2u85o6qnLy8bVFiCwdGzakV+7Z3m/ASq2AJzzDYwWoVK1Fson61DHOYdVNNKxCxSHr+VGtEQG4GfdikrZfKW63Xv1OWblZ04dNLII6lTJfm0Z0D4D/3qt5U+B6Kk8fj4uL+DlNHK0cOyZL83PRyxeayOMz/ec4sw4qmKjtEcQ4A/DDe2+ASH3fopVWxA/AJsB42y2viDXWngl/YL95l3nIJyewYq/EGGZEmXQMw7/lMx8/M7WhZcK+/S33VJ/zlhlPyAM0z5HCd X-MS-Exchange-AntiSpam-MessageData: ybSPlochsyJ/W0DVbNtpH8/P+7pweVEiK/Nf+L65g6FyujQ0/c743jNU55H4XxmwWNGoYz5CGNuAuja7lHqpSOKU3h5o2wbWkQjqust4gziLLSYatFnRDeivJNn5WC5rjHeBFfMmnMNFyZbhRfYwIQ== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: a326f152-2bfa-4797-1255-08d94b1526f3 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2021 00:27:27.4215 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: AM6EUR05FT063.eop-eur05.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6EUR05HT071 Received-SPF: pass client-ip=40.92.90.38; envelope-from=arthur.miller@live.com; helo=EUR05-VI1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:271370 Archived-At: --=-=-= Content-Type: text/plain The puropose of "quickstart" file is to perform some calculations offline to speed up startup time, and what I see in generated code that every package is added to load-path with `add-to-list' function, which will ensure that each object is added only once. Since quickstart file is created by iterating through each and one installed package whose path is already known, this calculation can be performed once at generation time, rather than every time when Emacs starts. It is relatively simple to alter the generator routine for this, I have included patch. I have been doing something similar in my personal init file since quite some time now and have not had problems, but I am not that sofisticated user. I guess this won't speed thing much, maybe people who use large number of packages could see some difference. Regardless it is still an unnecessary computation and thus waste of cpu (and battery) to do this every startup if it can be done only once when package-quickstart.el is generated. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=package.patch --- ../emacs/lisp/emacs-lisp/package.el 2021-07-11 12:20:59.257657537 +0200 +++ ./package.el 2021-07-20 02:01:38.050169037 +0200 @@ -4137,7 +4137,8 @@ (package-activated-list ()) ;; Make sure we can load this file without load-source-file-function. (coding-system-for-write 'emacs-internal) - (Info-directory-list '(""))) + (Info-directory-list '("")) + paths) (dolist (elt package-alist) (condition-case err (package-activate (car elt)) @@ -4155,6 +4156,7 @@ (let ((load-suffixes '(".el" ".elc"))) (locate-library (package--autoloads-file-name pkg)))) (pfile (prin1-to-string file))) + (push (package-desc-dir pkg) paths) (insert "(let ((load-true-file-name " pfile ")\ (load-file-name " pfile "))\n") (insert-file-contents file) @@ -4164,6 +4166,10 @@ (replace-match (if (match-end 1) "" pfile) t t))) (unless (bolp) (insert "\n")) (insert ")\n"))) + (goto-char (point-min)) + (while (re-search-forward "^(add-to-list.*load-path" nil t) + (goto-char (line-beginning-position)) + (kill-sexp)) (pp `(setq package-activated-list (append ',(mapcar #'package-desc-name package--quickstart-pkgs) package-activated-list)) @@ -4175,6 +4181,10 @@ (setq Info-directory-list (append ',info-dirs Info-directory-list))) (current-buffer)))) + (goto-char (point-min)) + (forward-line 3) + (insert (concat "\n(nconc load-path '" (prin1-to-string paths) ")\n")) + (goto-char (point-max)) ;; Use `\s' instead of a space character, so this code chunk is not ;; mistaken for an actual file-local section of package.el. (insert " --=-=-=--