From: Steinar Bang <sb@dod.no>
To: help-gnu-emacs@gnu.org
Subject: Re: How to profile restoring from .emacs.desktop
Date: Thu, 28 Jan 2021 18:51:25 +0100 [thread overview]
Message-ID: <86v9bhlzky.fsf@dod.no> (raw)
In-Reply-To: <jwvwnvyxot7.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 27 Jan 2021 12:42:17 -0500")
>>>>> Stefan Monnier <monnier@iro.umontreal.ca>:
> Hi Steinar,
>> Is it possible to profile the restore from .emacs.desktop in some way?
> You can add
> (profiler-start 'cpu)
> in your init file somewhere before loading the `.emacs.desktop` and then
> call `M-x profiler-report` when the startup is done
Thanks, Stefan!
I did exactly that:
1. Put (profiler-start 'cpu) at the end of ~/.emacs
2. Did `M-x profiler-report` after the startup has completed
And it worked perfectly!
I succeeded in saving the profile to a file. I have no idea how/if it
can be loaded from that file, but the saved profile is here:
https://gist.github.com/steinarb/fbb854a40f058cf561cbc333f64bc967
But a deep analysis probably isn't necessary, opening the biggest nodes
in the profile, it's pretty obvious that the biggest culprit is
projectile-discover-projects-in-directory the function it calls, with
the biggest chunks, before it all breaks down into many small things,
are projectile-serialize and projectile-difference.
So it's projectile project discovery that spends most of the time.
I wonder if that information can be cached...?
Here's the profiler tree with the most interesting (to me) nodes opened:
- normal-top-level 116518 92%
- command-line 116518 92%
- command-line-1 116510 92%
- eval 116506 92%
- progn 116506 92%
- desktop-read 116506 92%
- load 116355 92%
- load-with-code-conversion 116355 92%
- eval-buffer 116346 92%
- desktop-create-buffer 116281 92%
- projectile-mode 102201 81%
- projectile-discover-projects-in-search-path 96086 76%
- mapcar 96086 76%
- projectile-discover-projects-in-directory 96086 76%
- mapcar 95579 75%
- #<compiled 0x10bffb5> 95540 75%
- projectile-add-known-project 90190 71%
- projectile-merge-known-projects 85962 68%
- projectile-save-known-projects 45969 36%
- projectile-serialize 43930 34%
+ write-region 11854 9%
+ #<compiled 0x134d99d> 1988 1%
+ get-buffer-create 106 0%
- projectile-difference 18874 14%
- cl-remove-if 18650 14%
- apply 18631 14%
cl-remove 12671 10%
+ projectile-unserialize 15287 12%
delete-dups 3281 2%
+ abbreviate-file-name 1425 1%
delete-dups 1081 0%
+ projectile-ignored-project-p 37 0%
+ projectile-project-p 4587 3%
directory-files 13 0%
+ projectile--cleanup-known-projects 5784 4%
+ projectile-load-known-projects 210 0%
+ projectile-commander-bindings 53 0%
+ advice-add 36 0%
+ called-interactively-p 3 0%
add-hook 2 0%
+ desktop-restore-file-buffer 7532 5%
+ dired-restore-desktop-buffer 3346 2%
+ desktop-load-file 1498 1%
+ bury-buffer 1081 0%
+ rename-buffer 476 0%
+ auto-revert-mode 71 0%
+ flycheck-mode 12 0%
+ editorconfig-mode 9 0%
+ nxml-psgml-compatibility-mode 4 0%
buffer-list 4 0%
+ auto-fill-mode 4 0%
+ internal-macroexpand-for-load 11 0%
+ do-after-load-evaluation 9 0%
+ desktop-restore-frameset 147 0%
+ byte-code 4 0%
+ lisp-interaction-mode 4 0%
- ... 8332 6%
Automatic GC 8299 6%
+ minibuffer-complete 25 0%
+ cl--generic-get-dispatcher 4 0%
+ rng-compute-start-tag-close-deriv 4 0%
+ timer-event-handler 1021 0%
+ command-execute 108 0%
+ redisplay_internal (C function) 67 0%
+ flycheck-handle-signal 12 0%
+ flycheck-hide-error-buffer 3 0%
next prev parent reply other threads:[~2021-01-28 17:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-27 17:11 How to profile restoring from .emacs.desktop Steinar Bang
2021-01-27 17:42 ` Stefan Monnier
2021-01-28 17:51 ` Steinar Bang [this message]
2021-01-28 19:08 ` Stefan Monnier
2021-01-28 22:31 ` Steinar Bang
2021-01-28 22:58 ` Stefan Monnier
2021-01-28 23:33 ` Dmitry Gutov
2021-06-19 9:02 ` project-mode vs projectile (Was: How to profile restoring from .emacs.desktop) Steinar Bang
2021-06-27 0:20 ` Dmitry Gutov
2021-09-05 11:35 ` project-mode vs projectile Steinar Bang
2021-09-05 14:56 ` Nikolay Kudryavtsev
2021-10-07 2:39 ` Dmitry Gutov
2021-01-29 22:05 ` How to profile restoring from .emacs.desktop Steinar Bang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86v9bhlzky.fsf@dod.no \
--to=sb@dod.no \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).