unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Victor Nawothnig <victor.nawothnig@icloud.com>
Cc: 49127@debbugs.gnu.org
Subject: bug#49127: Performance degradation in encode_coding_object
Date: Sun, 20 Jun 2021 12:04:59 +0300	[thread overview]
Message-ID: <83eecwvrd0.fsf@gnu.org> (raw)
In-Reply-To: <ACD4B349-8EAE-4697-99B0-0C3F2C678E93@icloud.com> (bug-gnu-emacs@gnu.org)

> Date: Sun, 20 Jun 2021 08:30:24 +0200
> From:  Victor Nawothnig via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> With gprof/prof_events I have nailed the problem to be encode_coding_object looping over all markers. In degenerate cases this list can contain millions of markers. Traversing this list is particularly slow because of the indirection being a singly linked list. Based on the fact that a GC remedies this, I’m assuming this list contains mostly  unreachable markers. When stepping through encode_coding_object with GDB after a GC this list of markers shrinks to small double digit numbers from millions.
> 
> The source of these markers appears to be looking-at in the font locking code of haskell-mode, this assumption is based on the fact that commenting out the uses of looking-at in haskell-mode prevents the accumulation of markers and thus the slowdown.

Do you understand why using looking-at causes creation of markers?  If
so, can you show the details of why this happens?

> One contributing factor to all of this, is that for lsp-mode to perform adequately, one needs a relatively high gc-cons-threshold, which means GCs that would clean up the markers run more rarely, leading to higher accumulation of markers over time.

Yes, playing with GC threshold is usually a bad idea, but it is hard
to explain to people why, and they keep doing that, to their cost.

> This problem only triggers in terminal frames, but not in GUI frames. Setting GDB breakpoints suggests that the GUI frame never even calls into encode_coding_object.

Can you should a backtrace from the call to encode_coding_object,
including the Lisp backtrace (via the "xbacktrace" command)?

> So far I’m torn on whether this is a bug in the haskell-mode font locking code or in Emacs. What do you think?

Let's revisit this question after we have all the data I requested
above, okay?

Thanks.





  reply	other threads:[~2021-06-20  9:04 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-20  6:30 bug#49127: Performance degradation in encode_coding_object Victor Nawothnig via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-06-20  9:04 ` Eli Zaretskii [this message]
2021-06-24 16:49   ` Eli Zaretskii
2021-07-25  7:10     ` Eli Zaretskii
2021-08-15 15:07       ` Eli Zaretskii
2021-08-17 12:35         ` Eli Zaretskii
     [not found] <EC5DED64-8465-45A3-B20C-8D21F70E0A34@acm.org>
2021-08-16 17:43 ` Eli Zaretskii
2021-08-16 18:06   ` Mattias Engdegård
2021-08-16 18:50     ` Eli Zaretskii
2021-08-16 20:04       ` Mattias Engdegård
2021-08-17 12:34         ` Eli Zaretskii
2021-08-17 13:06           ` Mattias Engdegård
2021-08-17 14:05             ` Eli Zaretskii
2021-08-17 16:07               ` Mattias Engdegård
2021-08-17 17:16                 ` Eli Zaretskii
2021-08-18 11:04                   ` Mattias Engdegård
2021-08-18 11:43                     ` Eli Zaretskii
2021-08-18 12:21                       ` Mattias Engdegård
2021-08-18 13:23                         ` Eli Zaretskii
2021-08-18 13:32                           ` Mattias Engdegård
2021-08-18 13:39                             ` Eli Zaretskii
2021-08-18 13:54                               ` Mattias Engdegård
2021-08-18 13:59                                 ` Eli Zaretskii
2021-08-18 15:24                                   ` Mattias Engdegård
2021-08-18 14:34                             ` Lars Ingebrigtsen
2021-08-20 23:24                               ` Michael Welsh Duggan
2021-08-21  6:34                                 ` Eli Zaretskii

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=83eecwvrd0.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=49127@debbugs.gnu.org \
    --cc=victor.nawothnig@icloud.com \
    /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).