all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emacs/prelude: lag in opening big files
@ 2017-07-21  2:07 Vikas Rawal
  2017-07-21 13:43 ` Eli Zaretskii
  2017-07-21 14:34 ` Stefan Monnier
  0 siblings, 2 replies; 3+ messages in thread
From: Vikas Rawal @ 2017-07-21  2:07 UTC (permalink / raw)
  To: help-gnu-emacs

I have recently shifted to using prelude for my emacs configuration.

I am having a strange problem that I have never faced before.  When I open (C-f) a large file, it gets stuck for a long time. I have to wait for eternity before the file would open. But if I C-g and cancel the process, and do it again, the second time, it opens in a snap.
I have tried it with many files, and it happens each time. If a file is opened and closed, and I want to open it again, emacs does the same thing all over again. That is, slow to open first time, but opens in a snap if I C-g and start again.

How do I debug this? I tried to use profiler to figure out where was emacs stuck. Below is the main part of the report on cpu usage when I tried to open a large org mode file. Looks like helm is one of the culprits. Is this usual? Is there a way to deal with this?

Vikas




- command-execute                                                6903  57%
 - call-interactively                                            6903  57%
  - funcall-interactively                                        6575  54%
   - helm-find-files                                             6575  54%
    - helm-find-files-1                                          6575  54%
     - helm                                                      6575  54%
      - apply                                                    6575  54%
       - helm                                                    6575  54%
        - apply                                                  6575  54%
         - helm-internal                                         6575  54%
          - helm-execute-selection-action                        6103  50%
           - helm-execute-selection-action-1                     6103  50%
            - helm-find-file-or-marked                           6102  50%
             - apply                                             6102  50%
              + #<compiled 0x40bf3dad>                           6102  50%
            + helm-get-actions-from-current-source                  1   0%
          + helm-read-pattern-maybe                               470   3%
          + helm-initialize                                         1   0%
          + #<compiled 0x43fa6779>                                  1   0%
  + byte-code                                                     328   2%
- timer-event-handler                                            5047  41%
 - apply                                                         5047  41%
  - org-indent-initialize-agent                                  5042  41%
   - org-indent-initialize-buffer                                5041  41%
    - org-indent-add-properties                                  5030  41%
     - org-indent-set-line-properties                            1159   9%
        org-add-props                                               1   0%
     - org-at-item-p                                               29   0%
      + org-list-in-valid-context-p                                26   0%
       org-list-item-body-column                                    1   0%
       org-current-level                                            1   0%
       #<compiled 0x40495149>                                       1   0%
     cancel-timer                                                   1   0%
  + savehist-autosave                                               4   0%
    auto-revert-buffers                                             1   0%


Vikas

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Emacs/prelude: lag in opening big files
  2017-07-21  2:07 Emacs/prelude: lag in opening big files Vikas Rawal
@ 2017-07-21 13:43 ` Eli Zaretskii
  2017-07-21 14:34 ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2017-07-21 13:43 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Vikas Rawal <vikaslists@agrarianresearch.org>
> Date: Fri, 21 Jul 2017 07:37:55 +0530
> 
> I am having a strange problem that I have never faced before.  When I open (C-f) a large file, it gets stuck for a long time. I have to wait for eternity before the file would open. But if I C-g and cancel the process, and do it again, the second time, it opens in a snap.
> I have tried it with many files, and it happens each time. If a file is opened and closed, and I want to open it again, emacs does the same thing all over again. That is, slow to open first time, but opens in a snap if I C-g and start again.
> 
> How do I debug this? I tried to use profiler to figure out where was emacs stuck. Below is the main part of the report on cpu usage when I tried to open a large org mode file. Looks like helm is one of the culprits. Is this usual? Is there a way to deal with this?
> 
> Vikas
> 
> 
> 
> 
> - command-execute                                                6903  57%
>  - call-interactively                                            6903  57%
>   - funcall-interactively                                        6575  54%
>    - helm-find-files                                             6575  54%
>     - helm-find-files-1                                          6575  54%
>      - helm                                                      6575  54%
>       - apply                                                    6575  54%
>        - helm                                                    6575  54%
>         - apply                                                  6575  54%
>          - helm-internal                                         6575  54%
>           - helm-execute-selection-action                        6103  50%
>            - helm-execute-selection-action-1                     6103  50%
>             - helm-find-file-or-marked                           6102  50%
>              - apply                                             6102  50%
>               + #<compiled 0x40bf3dad>                           6102  50%
>             + helm-get-actions-from-current-source                  1   0%

You stopped expanding the profile too early: you should continue
expanding "#<compiled 0x40bf3dad>" and the levels below it, until you
find a significant change in the percentage -- that is where most of
the CPU processing is spent.  (My guess would be it's
org-indent-add-properties, but that's just a guess.)  For more
accurate profile, load all the libraries involved in this as *.el
files, not as *.elc.

(This should probably be a bug report.)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Emacs/prelude: lag in opening big files
  2017-07-21  2:07 Emacs/prelude: lag in opening big files Vikas Rawal
  2017-07-21 13:43 ` Eli Zaretskii
@ 2017-07-21 14:34 ` Stefan Monnier
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2017-07-21 14:34 UTC (permalink / raw)
  To: help-gnu-emacs

> I am having a strange problem that I have never faced before.
> When I open (C-f) a large file, it gets stuck for a long time. I have
> to wait for eternity before the file would open. But if I C-g and
> cancel the process, and do it again, the second time, it opens in
> a snap.

That's because the C-g doesn't kill the "not quite finished" new buffer.
And the second time around find-file encounters the "not quite finished"
buffer, has no idea it's "not quite finished" and just displayed it as
it is without further ado.

> How do I debug this?

    M-: (setq debug-on-error t debug-on-quit t)
    C-f ../new-big-file
    C-g

should give you a backtrace which shows what Emacs is in the process
of doing.


        Stefan




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-21 14:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-21  2:07 Emacs/prelude: lag in opening big files Vikas Rawal
2017-07-21 13:43 ` Eli Zaretskii
2017-07-21 14:34 ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.