Subject: Re: bug#15755: 24.3.50; cperl-mode annoyingly slow on my netbook

From: Jambunathan K <[email-masked]>
Date: Thu, 31 Oct 2013 01:13:47 +0530

Stefan Monnier <[email-masked]> writes:

>> On my netbook (HP Mini 110) cperl-mode responds so slowly that it is
>> very annoying to type.
>
> Usually, cperl-mode is fast enough (most of my machines are about as
> powerful as a typical netbook).  So maybe you're just hitting a bug
> (tho, maybe you're hitting a pathological case, as well).
>
> Do you have some test case we can use to reproduce the problem?

If indeed this is a bug, I would call it a "showstopper" for cperl-mode.

Here is a recipe.  The file used below is the Oddmuse's Wiki engine.

mkdir ~/tmp

cd ~/tmp

wget http://git.savannah.gnu.org/cgit/oddmuse.git/plain/wiki.pl

emacs -Q

Here is a report from M-x view-lossage RET.  I do this:

1. C-x C-f ~/tmp/wiki.pl
2. M-x cperl-mode
3. C-s ApplyRules {
4. C-a
5. Move the cursor down a few lines
6. C-M-e.  Jump to end of defun. Move up a few lines to seek the comment
   line.
7. Type a few characters

(5) is slow. (7) is very slow.  Meaning it takes ages for the 10 or so
characters to be echoed.

Interestingly, after (2) I see the following message reported by
cperl-mode.  I am not sure whether the error is a cause for slow
performance.

Anyways, if I do,

    perl wiki.pl

I don't see the perl complaining about the file being bad.  So there is
a bug somewhere.

Apart from the recipe above, you can try the following

1. Mark the ApplyRules sub.
2. M-x indent-region it.

With perl-mode, (1) and (2) is very quick.  But with cperl-mode things
are bad.

--8<---------------cut here---------------start------------->8---
End of `qw( ... )' string/RE not found: (scan-error Unbalanced parentheses 1543 155427)
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
C-x C-f t m p / w i k i . p l <return> <escape> x c
p e r l - m o d e <return> C-s A p p l y R u l e s
SPC { C-a <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> C-M-e
<up> <up> <up> C-e SPC i n s e r t i n g SPC t h i
s SPC t e x t SPC t a k e s SPC a SPC l o t SPC o f
SPC t i m e <escape> x v i e w - l o s s a g e <re
turn>
--8<---------------cut here---------------end--------------->8---

>         Stefan