From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Steinar Bang Newsgroups: gmane.emacs.help Subject: Re: How to profile restoring from .emacs.desktop Date: Thu, 28 Jan 2021 23:31:46 +0100 Message-ID: <86o8h8n165.fsf@dod.no> References: <864kj2nw2s.fsf@dod.no> <86v9bhlzky.fsf@dod.no> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31936"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (windows-nt) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 28 23:32:57 2021 Return-path: Envelope-to: geh-help-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 1l5FqS-0008C7-Um for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 28 Jan 2021 23:32:57 +0100 Original-Received: from localhost ([::1]:40340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5FqS-0003Y0-0Q for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 28 Jan 2021 17:32:56 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5FpV-0003Xr-PQ for help-gnu-emacs@gnu.org; Thu, 28 Jan 2021 17:31:57 -0500 Original-Received: from cadalora.default.sbang.uk0.bigv.io ([2001:41c9:1:424::90]:49826) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5FpP-0004rA-EK for help-gnu-emacs@gnu.org; Thu, 28 Jan 2021 17:31:56 -0500 Original-Received: from mccoy (cm-84.210.87.211.getinternet.no [84.210.87.211]) by cadalora.default.sbang.uk0.bigv.io (Postfix) with ESMTPSA id 8F985CD422 for ; Thu, 28 Jan 2021 22:31:47 +0000 (GMT) In-Reply-To: (Stefan Monnier's message of "Thu, 28 Jan 2021 14:08:10 -0500") Received-SPF: none client-ip=2001:41c9:1:424::90; envelope-from=sb@dod.no; helo=cadalora.default.sbang.uk0.bigv.io X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:127413 Archived-At: >>>>> Stefan Monnier : >> So it's projectile project discovery that spends most of the time. >> I wonder if that information can be cached...? > I don't use Projectile and never looked at its code, so I can't answer > that. I googled and found this: https://stackoverflow.com/a/50997907 I changed the script I use to restore an emacs tunnelled over an SSH X forwarding from: #!/bin/sh # # Brukes til =C3=A5 sparke igang eclipse og emacs n=C3=A5r jeg tar en ssh = til lorenzo # export REPOUSER=3Dmaven cd ~/workspaces emacs --eval "(progn (desktop-read)(desktop-save-mode 1))" >/dev/null 2>&1= & to #!/bin/sh # # Brukes til =C3=A5 sparke igang eclipse og emacs n=C3=A5r jeg tar en ssh = til lorenzo # export REPOUSER=3Dmaven cd ~/workspaces emacs --eval "(progn (setq projectile-enable-caching 't)(desktop-read)(des= ktop-save-mode 1))" >/dev/null 2>&1 & I then started emacs once and stopped it, and started emacs again with profiling on. The caching didn't seem to have much effect. See the opened profiling below. C-h v projectile-enable-caching says: projectile-enable-caching is a variable defined in =E2=80=98projectile.el= =E2=80=99. Its value is t Original value was nil (ie. the variable was successfully set) > I don't know either how Projectile compares to Emacs's builtin support > for projects (tho I expect it's significantly more featureful), but > you may want to try that builtin support instead of Projectile to see > if it suffers from a similar problem, and/or if it provides the subset > of features you happen to use. Sounds interesting. I've googled this as well and the one hit I found was emacs 28: https://www.gnu.org/software/emacs/manual/html_node/emacs/Projects.html Is this emacs 28 only? (I'm still on emacs 26 and 27) Here's the profile from starting up with a projectile cache in place: - normal-top-level 116753 92% - command-line 116753 92% - command-line-1 116749 92% - eval 116749 92% - progn 116749 92% - desktop-read 116745 92% - load 116609 92% - load-with-code-conversion 116609 92% - eval-buffer 116602 92% - desktop-create-buffer 116501 92% - projectile-mode 102763 81% - projectile-discover-projects-in-search-path 96535= 76% - mapcar 96535 76% - projectile-discover-projects-in-directory 96535= 76% - mapcar 96039 76% - # 96009 76% - projectile-add-known-project 90801 72% - projectile-merge-known-projects 86378 68% - projectile-save-known-projects 46828 37% - projectile-serialize 44868 35% - write-region 12417 9% - select-safe-coding-system 11873 9% - find-auto-coding 9805 7% auto-coding-alist-lookup 3012 2% sgml-html-meta-auto-coding-function = 1011 0% auto-coding-regexp-alist-lookup 540= 0% sgml-xml-auto-coding-function 392 = 0% + mapcar 58 0% find-coding-systems-region 43 0% coding-system-get 26 0% coding-system-type 22 0% + # 2120 1% + get-buffer-create 68 0% - projectile-difference 17815 14% - cl-remove-if 17598 14% - apply 17580 13% cl-remove 11888 9% - projectile-unserialize 15191 12% + insert-file-contents 5195 4% + # 3287 2% + generate-new-buffer 838 0% delete-dups 3816 3% + abbreviate-file-name 1526 1% delete-dups 1263 1% + projectile-ignored-project-p 20 0% + projectile-project-p 4475 3% directory-files 11 0% + projectile--cleanup-known-projects 5847 4% + projectile-load-known-projects 236 0% + projectile-commander-bindings 64 0% + advice-add 56 0% called-interactively-p 1 0% + desktop-restore-file-buffer 7767 6% + dired-restore-desktop-buffer 3833 3% + bury-buffer 1074 0% + rename-buffer 529 0% + desktop-load-file 338 0% + auto-revert-mode 52 0% + flycheck-mode 33 0% editorconfig-mode 8 0% buffer-list 4 0% + nxml-psgml-compatibility-mode 3 0% + smerge-mode 3 0% + internal-macroexpand-for-load 23 0% + do-after-load-evaluation 7 0% + desktop-restore-frameset 136 0% # 4 0% + ... 8194 6% + timer-event-handler 563 0% + command-execute 99 0% + redisplay_internal (C function) 34 0% + flycheck-handle-signal 8 0%