aspell slow down within Emacs

Fabrizio Sidoli <[email protected]> Tue, 19 Jan 2010 15:48:55 +0000 (GMT)
Newsgroups gmane.comp.gnu.aspell.user
Message-ID <[email protected]>
Hi,

I was wondering if someone could help me with a problem I am having with 
aspell.

I am using an Emacs lisp function called flyspell.el that uses aspell. 
Flyspell is a fully-automatic way to check spelling as you edit in Emacs.

The problem I'm having is that aspell causes Emacs to slow down when 
moving the cursor over words (presumably because it is checking them), 
especially if I happen to be scrolling along a line. It can hang for up to 
2 or 3 seconds before I can do anything else in the Emacs window.

I first discovered this problem three years ago whilst writing my thesis 
and after months of investigating I discovered that aspell was cause of my 
problem. At the time, I simply forced Emacs to use ispell instead which 
solved my problem completely. I can not do this now and so I am forced to 
use aspell.

I can see that the following aspell command options are running on my 
system, which I seem to actually have no control over.

ps -ef | grep spell
<SNIP>   aspell -a -m -d british -B -d british

If I run top and then move to the Emacs windows and move my cursor from left to 
right using the arrow keys I can see that aspell jumps to the top with almost 
100% CPU usage.

If I use strace then I get outputs like the following:

read(0, "!\n+\n!\n+\n", 4096)           = 8
read(0, "!\n+\n!\n+\n!\n+\n!\n+\n", 4096) = 16
read(0, "!\n+\n!\n+\n!\n+\n!\n+\n!\n+\n!\n+\n!\n+\n!\n+\n", 4096) = 32
read(0, "!\n+\n!\n+\n!\n+\n!\n+\n!\n+\n!\n+\n!\n+\n!\n+\n"..., 4096) = 68
read(0, "!\n+\n!\n+\n!\n+\n!\n+\n!\n+\n!\n+\n!\n+\n!\n+\n"..., 4096) = 63
write(1, "*\n", 2)                      = 2
write(1, "\n", 1)                       = 1
read(0, "!\n", 4096)                    = 2
read(0, "+\n", 4096)                    = 2
read(0, "!\n+\n!\n+\n!\n+\n!\n+\n!\n+\n!\n+\n!\n+\n%\n^t"..., 4096) = 35
write(1, "*\n", 2)                      = 2
write(1, "\n", 1)                       = 1
read(0, "!\n", 4096)                    = 2
read(0, "+\n", 4096)                    = 2
read(0, "!\n+\n!\n+\n", 4096)           = 8
read(0,

I can see that Emacs slows at the very first write statements and then 
frees up again after the last pair of write statements. I have no idea 
what any of that actually means but I assume that aspell is writing to 
some file which is causing the system to slow down.

Are the flags that aspell is running with above causing this? What file is 
aspell actually writing to? Is it looking at too many dictionaries when it 
is checking words? How do I change the options aspell uses?

Regards,
Fabrizio