unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Mitchell <mitchellahren@gmail.com>
Cc: 71644@debbugs.gnu.org
Subject: bug#71644: 30.0.50; Severe slowdown in larger files with markers beginning in emacs 29+
Date: Sat, 22 Jun 2024 11:09:25 -0400	[thread overview]
Message-ID: <jwvmsnd6o75.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAOQwW=bUhFRK7b4F-RrNRWmuKe4sFazPx++WubSF2scCuvrU1A@mail.gmail.com> (Mitchell's message of "Tue, 18 Jun 2024 23:25:18 -0600")

> 1. Start emacs 29.3 (or 30.0.50) with emacs -q.
> 2. Paste the minimal config at
> https://gist.github.com/kings2u/30b7a22dfa38fe0d5dc18adaf0e5e9de into the
> scratch buffer and eval-buffer. (Note on my system I'm using the `counsel`
> version current as of counsel-20240502.743, but any recent version will
> reproduce the bug).

I used the code below:

    (customize-set-variable 'large-file-warning-threshold nil)
    (package-install 'counsel)
    (package-activate 'counsel)

> 7. Start typing `n` `space`, or `t` `space` several times very fast and
> observe how long it takes for the abbrev expansions (defined in the minimal
> config above) to show up on the screen.

Without running `counsel-outline`, the insertion is "immediate", whereas
after `counsel-outline` it takes about two seconds for me.

> Using emacs 29+, when I use `profiler-start` (CPU) between Steps 4 and 5,
> and then `profiler-stop` after Step 7, I get a very big entry (e.g., 70%)
> for `redisplay_internal (C function)` in the `profiler-report`. Using the
> `profiler` at the same points using emacs 28.2, I don’t get a big entry for
> `redisplay_internal (C function)`.

[ I haven't been able to get a meaningful profiler report yet.
  E.g. I get 82% of the time given to `read-from-minibuffer`, which is
  presumably the time spent typing `M-x profiler-report RET` or some
  such, even though I typed enough `n SPC` repetitions that it should
  dwarf that.  Not sure what's going on.  ]

Also I notice that if I do `n` and then wait, it takes the same
amount of time to see the result as if I do `n n n n`
and then wait.  So it seems that the command themselves execute
"instantly", and the delay occurs later (jit-lock? redisplay? ...).

I also notice that step 6 is important: if I just go straight to line 35
and type text, there's no delay.
Other thing I noticed

   M-g M-g 60000 RET
   n n n n n
   M-g M-g 35 RET
   n n n n n

there's no delays typing the `n` at line 60000 but there is a 2s delay
at line 35.

The fact that the absence of non-ASCII chars eliminates the problem
strongly points the finger to the bytes<->chars conversion which relies
on markers, indeed, but it's still very puzzling: line 35 is about 1.5kB
from the beginning of the buffer, so the conversion should be simple
and fast. there.  IOW, if it's a slow bytes<->chars conversion it's
probably a conversion taking place elsewhere than near point.

AFAICT the most significant change w.r.t markers in Emacs-29 is that
markers aren't used internally for overlays any more, so there are
usually *fewer* markers in Emacs-29 buffers than in Emacs-28 buffers
(which can be both favorable and detrimental to bytes<->chars
conversion, depending on details).  But in any case, (overlays-in
(point-min) (point-max)) tells me there's only one overlay and even 0 in
Emacs-28, so that can't be the reason for the change.


        Stefan "puzzled"






      parent reply	other threads:[~2024-06-22 15:09 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-19  5:25 bug#71644: 30.0.50; Severe slowdown in larger files with markers beginning in emacs 29+ Mitchell
2024-06-19 12:56 ` Eli Zaretskii
2024-06-20 13:49   ` Ihor Radchenko
2024-06-20 16:11     ` Eli Zaretskii
2024-06-20 16:24       ` Eli Zaretskii
2024-06-20 18:57   ` Mitchell
2024-06-20 19:04     ` Eli Zaretskii
2024-06-21  2:46       ` Mitchell
2024-06-21  6:19         ` Ihor Radchenko
2024-06-21 20:53           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-22  5:23             ` Gerd Möllmann
2024-06-22 14:10             ` Ihor Radchenko
2024-06-22 15:52               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-25  3:07               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-25  4:00                 ` Eli Zaretskii
2024-06-25  9:30                 ` Ihor Radchenko
2024-06-25 13:44                   ` Eli Zaretskii
2024-06-25 13:50                     ` Ihor Radchenko
2024-06-25 13:57                       ` Eli Zaretskii
2024-06-25 14:25                         ` Ihor Radchenko
2024-06-26  3:53                         ` Mitchell
2024-06-26 12:41                           ` Eli Zaretskii
2024-06-25 20:54                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-26 11:41                   ` Eli Zaretskii
2024-06-26 12:35                     ` Ihor Radchenko
2024-06-26 13:30                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-26 13:49                       ` Ihor Radchenko
2024-06-26 14:08                         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-29 21:27                           ` Mitchell
2024-06-25 21:02               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-21  6:48         ` Eli Zaretskii
2024-06-21 21:06           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-22  6:57             ` Eli Zaretskii
2024-06-22 18:03               ` Mitchell
2024-06-22 18:17                 ` Eli Zaretskii
2024-06-24  7:09                   ` Mitchell
2024-06-24 12:38                     ` Eli Zaretskii
2024-06-25  3:08                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-22 13:53 ` Ihor Radchenko
2024-06-22 14:12   ` Eli Zaretskii
2024-06-22 14:15     ` Eli Zaretskii
2024-06-22 15:09 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]

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=jwvmsnd6o75.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=71644@debbugs.gnu.org \
    --cc=mitchellahren@gmail.com \
    --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).