help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to profile restoring from .emacs.desktop


From: Steinar Bang
Subject: Re: How to profile restoring from .emacs.desktop
Date: Thu, 28 Jan 2021 23:31:46 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (windows-nt)

>>>>> Stefan Monnier <monnier@iro.umontreal.ca>:

>> 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 å sparke igang eclipse og emacs når jeg tar en ssh til lorenzo
 #
 export REPOUSER=maven
 cd ~/workspaces
 emacs --eval "(progn (desktop-read)(desktop-save-mode 1))" >/dev/null 2>&1 &
to
 #!/bin/sh
 #
 # Brukes til å sparke igang eclipse og emacs når jeg tar en ssh til lorenzo
 #
 export REPOUSER=maven
 cd ~/workspaces
 emacs --eval "(progn (setq projectile-enable-caching 
't)(desktop-read)(desktop-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 ‘projectile.el’.
 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%
               - #<compiled 0xf66071>                           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%
                    + #<compiled 0x124135d>                      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%
                   + #<compiled 0x119c0b9>                       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%
    #<compiled 0x1dda91>                                            4   0%
+ ...                                                            8194   6%
+ timer-event-handler                                             563   0%
+ command-execute                                                  99   0%
+ redisplay_internal (C function)                                  34   0%
+ flycheck-handle-signal                                            8   0%



reply via email to

[Prev in Thread] Current Thread [Next in Thread]