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: Mon, 16 Aug 2021 20:43:20 +0300 Message-ID: <83sfz970av.fsf@gnu.org> References: 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="23684"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 49127@debbugs.gnu.org, victor.nawothnig@icloud.com To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 16 19:44:10 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 1mFgef-0005sP-KT for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Aug 2021 19:44:09 +0200 Original-Received: from localhost ([::1]:59028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mFged-0004Tn-Jf for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Aug 2021 13:44:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mFgeX-0004Tc-U0 for bug-gnu-emacs@gnu.org; Mon, 16 Aug 2021 13:44:01 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39359) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mFgeX-00081C-ND for bug-gnu-emacs@gnu.org; Mon, 16 Aug 2021 13:44:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mFgeX-0001yl-Lw for bug-gnu-emacs@gnu.org; Mon, 16 Aug 2021 13:44:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Aug 2021 17:44:01 +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.16291358147554 (code B ref 49127); Mon, 16 Aug 2021 17:44:01 +0000 Original-Received: (at 49127) by debbugs.gnu.org; 16 Aug 2021 17:43:34 +0000 Original-Received: from localhost ([127.0.0.1]:50905 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mFge5-0001xm-Sj for submit@debbugs.gnu.org; Mon, 16 Aug 2021 13:43:34 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:37300) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mFge3-0001xZ-BT for 49127@debbugs.gnu.org; Mon, 16 Aug 2021 13:43:32 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55958) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mFgdx-0007dQ-Q8; Mon, 16 Aug 2021 13:43:25 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4378 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 1mFgdx-0001R4-C0; Mon, 16 Aug 2021 13:43:25 -0400 In-Reply-To: (message from Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= on Mon, 16 Aug 2021 19:32:46 +0200) 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:212051 Archived-At: > From: Mattias EngdegÄrd > Date: Mon, 16 Aug 2021 19:32:46 +0200 > Cc: Eli Zaretskii , 49127@debbugs.gnu.org > > It looks very much like haskell-mode is producing way too many markers, and that should be easily fixed (I wrote a tentative pull request). However, the code in encode_coding_object appears broken. Look at the first loop in that function: > > if (EQ (src_object, dst_object)) > { > struct Lisp_Marker *tail; > > for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next) > { > tail->need_adjustment > = tail->charpos == (tail->insertion_type ? from : to); > need_marker_adjustment |= tail->need_adjustment; > } > } > > I don't know how this could ever work. We loop through the markers in the current buffer? Yes. Why do you think this loop is broken? > It is called from term.c with src_object and dst_object both being Qnil; no buffer is involved at all. At the very least the outer condition should have an "&& BUFFERP (dst_object)" added, and the loop should run through the markers of XBUFFER (dst_object) instead of current_buffer, no? > > `decode_coding_object` seem to get these things right but I only took a superficial look. It's probably copy-paste errors. It isn't a copy/paste, I think it's a simple omission. But if you look up-thread, you will see that I asked for xbacktrace results from the OP, to make sure I completely understand the reasons for the performance problem. I never got any responses for that. So if you can produce the Lisp backtraces in that case, and later test a fix, I'm quite sure I know how to fix this problem. TIA.