* bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers
@ 2014-10-12 8:24 Angelo Graziosi
2014-10-12 8:36 ` Eli Zaretskii
0 siblings, 1 reply; 8+ messages in thread
From: Angelo Graziosi @ 2014-10-12 8:24 UTC (permalink / raw)
To: 18696
I have see this trying to visit Cygwin setup.ini files [*], for example:
ftp://mirrors.kernel.org/sourceware/cygwin/x86_64/setup.ini
(it is a file of about 2.5 MiB).
After C-x C-f setup.ini, Emacs freezes (or hangs, if you prefer) and
does not respond for a while (> 1 minute), CPU is at 80-100%. Then it
works fine. Maybe it is processing the file but I wonder if this
'freezing' is to be expected.
I have experimented this with Cygwin and MSYS2-MinGW64 builds.
Ciao,
Angelo.
---
[*] Mode line shows it is in Config[Colon] mode
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers
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
0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2014-10-12 8:36 UTC (permalink / raw)
To: Angelo Graziosi; +Cc: 18696
> Date: Sun, 12 Oct 2014 10:24:18 +0200
> From: Angelo Graziosi <angelo.graziosi@alice.it>
>
> I have see this trying to visit Cygwin setup.ini files [*], for example:
>
> ftp://mirrors.kernel.org/sourceware/cygwin/x86_64/setup.ini
>
>
> (it is a file of about 2.5 MiB).
>
> After C-x C-f setup.ini, Emacs freezes (or hangs, if you prefer) and
> does not respond for a while (> 1 minute), CPU is at 80-100%. Then it
> works fine. Maybe it is processing the file but I wonder if this
> 'freezing' is to be expected.
If this is in "emacs -Q", then I cannot reproduce this in a MinGW
build. (You didn't say which version, so I tried the 24.3.94 pretest
and a recent trunk.)
If this is not in "emacs -Q", there's likely some optional feature
that causes that.
In any case, attaching a debugger during the freeze and looking what
does the main thread do should shed some light on this.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers
2014-10-12 8:36 ` Eli Zaretskii
@ 2014-10-12 10:24 ` Angelo Graziosi
2014-10-14 18:43 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Angelo Graziosi @ 2014-10-12 10:24 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 18696
Il 12/10/2014 10:36, Eli Zaretskii ha scritto:
>
> If this is not in "emacs -Q", there's likely some optional feature
> that causes that.
Indeed.. it is this in my initialization file:
(which-function-mode t)
and, considering the structure of that setup.ini file, this 'freezing'
could be expected..
Thanks,
Angelo.
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers
2014-10-12 10:24 ` Angelo Graziosi
@ 2014-10-14 18:43 ` Stefan Monnier
2021-08-19 14:55 ` Lars Ingebrigtsen
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2014-10-14 18:43 UTC (permalink / raw)
To: Angelo Graziosi; +Cc: 18696
> Indeed.. it is this in my initialization file:
> (which-function-mode t)
> and, considering the structure of that setup.ini file, this 'freezing' could
> be expected..
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).
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers
2014-10-14 18:43 ` Stefan Monnier
@ 2021-08-19 14:55 ` Lars Ingebrigtsen
2021-08-19 15:42 ` Andreas Schwab
2021-09-17 15:54 ` Lars Ingebrigtsen
0 siblings, 2 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-19 14:55 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 18696, Angelo Graziosi
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers
2021-08-19 14:55 ` Lars Ingebrigtsen
@ 2021-08-19 15:42 ` Andreas Schwab
2021-08-19 15:52 ` Lars Ingebrigtsen
2021-09-17 15:54 ` Lars Ingebrigtsen
1 sibling, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2021-08-19 15:42 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: 18696, Stefan Monnier, Angelo Graziosi
On Aug 19 2021, Lars Ingebrigtsen wrote:
> `(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*:" 1)
Does that work better?
"^[ \t]*\\([^ \t].*?\\)[ \t]*:"
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers
2021-08-19 15:42 ` Andreas Schwab
@ 2021-08-19 15:52 ` Lars Ingebrigtsen
0 siblings, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-19 15:52 UTC (permalink / raw)
To: Andreas Schwab; +Cc: 18696, Stefan Monnier, Angelo Graziosi
Andreas Schwab <schwab@linux-m68k.org> writes:
> On Aug 19 2021, Lars Ingebrigtsen wrote:
>
>> `(("Parameters" "^[ \t]*\\(.+?\\)[ \t]*:" 1)
>
> Does that work better?
>
> "^[ \t]*\\([^ \t].*?\\)[ \t]*:"
It's probably an improvement, but it's still very slow. (I.e., I
stopped it after half a minute, and it was still going.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#18696: Emacs freezes for a while visitin Conf (.ini)) buffers
2021-08-19 14:55 ` Lars Ingebrigtsen
2021-08-19 15:42 ` Andreas Schwab
@ 2021-09-17 15:54 ` Lars Ingebrigtsen
1 sibling, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-17 15:54 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 18696, Angelo Graziosi
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Perhaps `imenu-default-create-index-function' should just give up after
> spending more than x seconds?
I've now done this in Emacs 28.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-09-17 15:54 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2021-08-19 15:42 ` Andreas Schwab
2021-08-19 15:52 ` Lars Ingebrigtsen
2021-09-17 15:54 ` Lars Ingebrigtsen
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).