From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: 18696@debbugs.gnu.org, Angelo Graziosi <angelo.graziosi@alice.it>
Subject: bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers
Date: Thu, 19 Aug 2021 16:55:12 +0200 [thread overview]
Message-ID: <87bl5t5vsf.fsf@gnus.org> (raw)
In-Reply-To: <jwv1tqaqyse.fsf-monnier+emacsbugs@gnu.org> (Stefan Monnier's message of "Tue, 14 Oct 2014 14:43:49 -0400")
Stefan Monnier <monnier@IRO.UMontreal.CA> writes:
> Actually IIUC which-function-mode shouldn't cause such a slow down.
> If it does, it's probably because the major mode doesn't have special
> support for which-function-mode, so it falls back on using imenu's
> support, i.e. it needs to scan the whole buffer.
>
> This said, scanning the whole buffer shouldn't be that sow, unless you
> really have very many sections. So it might also simply be a bug in the
> way the major mode supports imenu (e.g. the regexp used is inefficient).
I can reproduce this problem in Emacs 28:
curl https://mirrors.kernel.org/sourceware/cygwin/x86_64/setup.ini > /tmp/setup.ini
./src/emacs -f which-function-mode -Q /tmp/setup.ini
y
Emacs hangs completely, and even `C-g' doesn't help.
The major mode here is conf-colon-mode, which does:
(setq-local imenu-generic-expression
`(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*:" 1)
,@(cdr imenu-generic-expression))))
And, indeed, removing that make the file open in a couple of seconds
instead of taking forever (where "forever" is defined as "longer than I
had patience to wait").
Hm... That regexp does have some backtracking in it, but this is
an 18MB file where 99.997% of the lines match the regexp:
sdesc: "Debug info for 2048-cli"
ldesc: "This package contains files necessary for debugging the
2048-cli package with gdb."
category: Debug
requires: cygwin-debuginfo
version: 0.9.1-1
etc.
So no matter how efficient the regexp is, it's gonna hang here.
Perhaps `imenu-default-create-index-function' should just give up after
spending more than x seconds?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
next prev parent reply other threads:[~2021-08-19 14:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-12 8:24 bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers Angelo Graziosi
2014-10-12 8:36 ` Eli Zaretskii
2014-10-12 10:24 ` Angelo Graziosi
2014-10-14 18:43 ` Stefan Monnier
2021-08-19 14:55 ` Lars Ingebrigtsen [this message]
2021-08-19 15:42 ` Andreas Schwab
2021-08-19 15:52 ` Lars Ingebrigtsen
2021-09-17 15:54 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bl5t5vsf.fsf@gnus.org \
--to=larsi@gnus.org \
--cc=18696@debbugs.gnu.org \
--cc=angelo.graziosi@alice.it \
--cc=monnier@IRO.UMontreal.CA \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).