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

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

Re: Emacs Slowdown


From: Eli Zaretskii
Subject: Re: Emacs Slowdown
Date: Mon, 09 Mar 2015 18:16:18 +0200

> From: address@hidden (Phillip Lord)
> Date: Mon, 09 Mar 2015 11:48:47 +0000
> 
> I am suffering a rather disasterous slowdown in my emacs. It feels like
> a memory leak, as my emacs gets slower over time. It mostly seems to be
> affected auctex, where there is considerable lag in cursor movement to
> the point that typing becomes difficult.

For starters, customize garbage-collection-messages to a non-nil
value, and see if Emacs announces GC while cursor movement is
sluggish.

> I've tried the profiler. After a long run, I find this for memory usage:
> 
> - redisplay_internal (C function)                       2,853,658,459  79%
>  - and                                                  2,682,842,214  74%
>   - directory-files                                           110,636   0%
>    - concat                                                    74,740   0%
>       regexp-quote                                             57,316   0%
>     file-directory-p
> 
> which is a bit strange. I have no idea when "and" should be getting
> called so much. The top of the CPU profile looks like this...

Forget the memory-usage profile, it doesn't measure what you think it
does, and is mostly useless, except in very specialized situations,
and then for people who really understand what this means (I don't).

If you want to test the hypothesis of a memory leak, it's easier to
look at your Emacs process's virtual memory size, either in 'top' or
in "M-x proced".  Take a few snapshots of the value and try to
correlate that with the values reported by 'garbage-collect'.  If
those values stay approximately stable, or go down, but the VSS of the
process goes up, you can suspect a memory leak; otherwise the problem
is elsewhere.

(Personally, I wouldn't pursue the memory leak avenue first,
especially if this is an official release, not a development version
of Emacs: I think other possible reasons are much more probable.  But
that's me.)

> One other thing that I have noticed is that define-global-minor-mode
> adds to the post-command-hook. Currently, this means that my
> post-command-hook looks like this....
> 
> 
> (global-font-lock-mode-check-buffers global-lentic-mode-check-buffers
> global-pabbrev-mode-check-buffers yas-global-mode-check-buffers
> global-eval-pulse-mode-check-buffers
> global-auto-complete-mode-check-buffers
> projectile-global-mode-check-buffers
> global-wide-column-mode-check-buffers
> wide-column-post-command-hook-function phil-show-paren-mode-check
> winner-save-old-configurations mode-local-post-major-mode-change)
> 
> which is an awful lot of functions to be called on every keypress. I
> realise that I may have gone a bit overboard here, especially as five of
> those functions are mine!

The question is: what do those hook do, on average?  If they are very
lightweight (profile them to see if they are), then this isn't your
villain.

Also, try removing most of the hooks when you see sluggish operation,
and see if that brings any significant speedup; if not, these aren't
what you are looking for.



reply via email to

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