From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#49127: Performance degradation in encode_coding_object Date: Thu, 24 Jun 2021 19:49:41 +0300 Message-ID: <83y2azryvu.fsf@gnu.org> References: <83eecwvrd0.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24003"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 49127@debbugs.gnu.org To: victor.nawothnig@icloud.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 24 18:50:11 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lwSYN-00063C-NP for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Jun 2021 18:50:11 +0200 Original-Received: from localhost ([::1]:36076 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lwSYM-0004sO-Kt for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Jun 2021 12:50:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lwSYH-0004sE-5H for bug-gnu-emacs@gnu.org; Thu, 24 Jun 2021 12:50:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60695) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lwSYE-0004oD-Ku for bug-gnu-emacs@gnu.org; Thu, 24 Jun 2021 12:50:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lwSYE-0007tq-J5 for bug-gnu-emacs@gnu.org; Thu, 24 Jun 2021 12:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Jun 2021 16:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49127 X-GNU-PR-Package: emacs Original-Received: via spool by 49127-submit@debbugs.gnu.org id=B49127.162455340230363 (code B ref 49127); Thu, 24 Jun 2021 16:50:02 +0000 Original-Received: (at 49127) by debbugs.gnu.org; 24 Jun 2021 16:50:02 +0000 Original-Received: from localhost ([127.0.0.1]:44008 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwSYD-0007tX-CK for submit@debbugs.gnu.org; Thu, 24 Jun 2021 12:50:01 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:35836) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwSYB-0007tI-NH for 49127@debbugs.gnu.org; Thu, 24 Jun 2021 12:50:00 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:49550) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lwSY6-0004iw-Cj; Thu, 24 Jun 2021 12:49:54 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2224 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lwSY5-0006d4-ED; Thu, 24 Jun 2021 12:49:54 -0400 In-Reply-To: <83eecwvrd0.fsf@gnu.org> (message from Eli Zaretskii on Sun, 20 Jun 2021 12:04:59 +0300) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:208951 Archived-At: Ping! Could you please respond to my requests below? I'd like to make some progress with this bug report. > Date: Sun, 20 Jun 2021 12:04:59 +0300 > From: Eli Zaretskii > Cc: 49127@debbugs.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" > > > > 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. > > > >