PDA

View Full Version : emacs file saving very slow



stuque
November 10th, 2011, 06:50 AM
Sometimes, after using Emacs for a while, saving becomes extremely slow, e.g. 30 seconds to save a file that was saved instantly a few moments ago.

Logging out and back in usually solves the problem for a while, but it always seems to come back.

I can see no other processes that are swamping the CPU, or other obvious problems (e.g. closing all other applications doesn't seem to help).

Suggestions about how I can go about debugging this problem would be appreciated.

Thanks.

11jmb
November 10th, 2011, 02:37 PM
Does that include processes that may be using lots of memory?

stuque
November 10th, 2011, 06:38 PM
Yes, I've checked memory and CPU usage via top while emacs is running slowly, and there is no obvious culprit.

NovaAesa
November 11th, 2011, 03:53 AM
I know this is an obvious question, but is the file being saved locally or on a network?

stuque
November 11th, 2011, 09:09 PM
Its local storage.

nvteighen
November 11th, 2011, 09:51 PM
0. Why has this been posted here? I think this should be moved to General Help, even though the "offending" application is a programming-related one.

1. Which OS are you using? No, this is not an obvious question: some people on these forums don't use Ubuntu. Even if it's Ubuntu, what version do you use? Have you checked for related bug reports?

2. Is it just emacs or other programs are also showing some lag? We should first prove that it is just emacs and something else what's having problems.

stuque
November 12th, 2011, 12:53 AM
I assume that mostly programmers use emacs, so it is more likely that programmers would either have experienced the problems I am having, or have ideas about how to go about debugging it.

I'm using Ubuntu 10.04 with XFCE (upgrading to a newer version is not an option for me right now).

No other programs seem to show any related problems: it's just emacs.

cgroza
November 12th, 2011, 03:31 PM
Did you do any modifications to your .emacs file before this problem appeared?

Arndt
November 12th, 2011, 08:15 PM
Some random thoughts to understand the problem better:

When it takes 30 seconds to save a file, is it the case that the runtime for the Emacs process increases with 30 seconds?

If you run without .emacs, does the same phenomenon occur?

You may prepare a debugger and attach to the Emacs process, and then interrupt it when a saving takes really long, but I don't know if that will show anything at all.

You could start Emacs with strace, and look at the system calls done during such a long save.

HappyCrow
January 16th, 2013, 04:56 AM
Put this in your ~/.emacs:

;; fix for slow emacs when saving files
(setq vc-handled-backends nil)

That worked for me.