Subject: 23.1; ispell-buffer with LaTeX file VERY slow in nextstep port of emacs 23.1.1
From: Steve Revilak <[email-masked]>
To: [email-masked]
Date: Sat, 5 Dec 2009 23:31:51 -0500

Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the [email-masked] mailing list,
and to the gnu.emacs.bug news group.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

I often use emacs for writing LaTeX, with the help of "aspell" as a
spell-checking program.  With the nextstep port of Emacs 23.1.1,
spell-checking a latex document is approximately 50 times slower than
spell-checking the same latex document with Emacs 22.3.1.

My test case uses the LaTeX version of GPL 3.0.  I've posted a copy of
the latex file here:

   http://www.cs.umb.edu/~srevilak/images/gpl-3.0.tex

I will also attempt to attach a copy of gpl-3.0.tex to this bug
report.

If you examine this copy of gpl-3.0.tex, you'll notice a "LocalWords"
section at the bottom.  As a preparation step, I've run this file
through ispell-buffer, and used `A' to add all misspelled words.  The
goal is to see how long it takes ispell-buffer to spell check the
file, and declare that there are no spelling errors.

Specific steps to reproduce:

1) start emacs, with --no-init-file

   shell>  /Applications/Emacs-23.1.app/Contents/MacOS/Emacs --no-init-file

2) switch to scratch buffer

    C-x b *scratch* RETURN

3) specify aspell as the ispell program

    ;; eval with C-x C-e
    (setq ispell-program "aspell")

4) Open gpl-3.0.tex

    C-x f /path/to/gpl-3.0.tex RETURN

5) spell-check the buffer

    M-x ispell-buffer RETURN

Again, I've arranged things such that there are no spelling errors for
aspell to find.

The nextstep port of emacs 23.1.1 takes 57 seconds to spell-check
gpl-3.0.tex.

By contrast, an older version of emacs: 

   GNU Emacs 22.3.1 (powerpc-apple-darwin8.11.0, Carbon Version 1.6.0)
    of 2009-03-28 on spud.local

takes less that 1 second to perform the same task, on the same
computer, using the same aspell binary.

As another point of contrast

   GNU Emacs 23.1.1 (i586-suse-linux-gnu, GTK+ Version 2.18.1) of
   2009-10-24 on build16

running on a GNU/Linux system also takes less than 1 second to
accomplish this task.  Thus, the `slow ispell-buffer' behavior appears
to be specific to the nextstep port of emacs 23.1.1, compiled on Mac
OS X.

The version of aspell that I am using:

   @(#) International Ispell Version 3.1.20 (but really Aspell 0.60.6)

uname -a output for this system:

   Darwin spud.local 8.11.0 Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC Power Macintosh powerpc

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
     `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/Applications/Emacs-23.1.app/Contents/Resources/etc/DEBUG for instructions.

In GNU Emacs 23.1.1 (powerpc-apple-darwin8.11.0, NS apple-appkit-824.48)
  of 2009-10-14 on spud.local
Windowing system distributor `Apple', version 10.3.824
configured using `configure  '--with-ns''

Important settings:
   value of $LC_ALL: nil
   value of $LC_COLLATE: C
   value of $LC_CTYPE: nil
   value of $LC_MESSAGES: nil
   value of $LC_MONETARY: nil
   value of $LC_NUMERIC: nil
   value of $LC_TIME: nil
   value of $LANG: en_US.UTF-8
   value of $XMODIFIERS: nil
   locale-coding-system: utf-8-unix
   default-enable-multibyte-characters: t

Major mode: LaTeX

Minor modes in effect:
   shell-dirtrack-mode: t
   tooltip-mode: t
   mouse-wheel-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   global-auto-composition-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   transient-mark-mode: t

Recent input:
C-x b <return> ( s e t q SPC ' <backspace> i s p e 
l l - p r o g r a m SPC " a p s e <backspace> <backspace> 
<backspace> s p e l l " ) C-x C-e C-x C-f D e <tab> 
g p <tab> <return> s-x M-x i s p <tab> - b <tab> <return> 
<help-echo> <down-mouse-1> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> s-x M-x i s p e l l - 
b u <tab> <return> <return> <backspace> C-x C-s M-x 
r e p o r t - e m <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
"aspell"
kill-region: The mark is not set now, so there is no region
Starting new Ispell process [default] ...
Spell-checking gpl-3.0.tex using aspell with default dictionary...done
kill-region: The mark is not set now, so there is no region
Spell-checking gpl-3.0.tex using aspell with default dictionary...done
Saving file /Users/srevilak/Desktop/gpl-3.0.tex...
Wrote /Users/srevilak/Desktop/gpl-3.0.tex