From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#43631: 28.0.50; CC Mode multiline strings grinds performance to a halt Date: Mon, 28 Sep 2020 19:33:25 +0000 Message-ID: <20200928193325.GA7626@ACM> References: <87lfgwwzw6.fsf@thornhill.no> <83pn68rcio.fsf@gnu.org> <87eemo4sor.fsf@thornhill.no> <83o8lsr6vq.fsf@gnu.org> <877dsgle4h.fsf@thornhill.no> <837dsgqzr1.fsf@gnu.org> <87pn67312v.fsf@thornhill.no> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="684"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 43631@debbugs.gnu.org To: Theodor Thornhill Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 28 21:34:15 2020 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 1kMyuc-000AdJ-Ro for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 28 Sep 2020 21:34:14 +0200 Original-Received: from localhost ([::1]:45128 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMyub-0007Wv-Ih for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 28 Sep 2020 15:34:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kMyuQ-0007Uu-My for bug-gnu-emacs@gnu.org; Mon, 28 Sep 2020 15:34:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42502) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kMyuQ-00028a-CQ for bug-gnu-emacs@gnu.org; Mon, 28 Sep 2020 15:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kMyuQ-0002O5-8N for bug-gnu-emacs@gnu.org; Mon, 28 Sep 2020 15:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Sep 2020 19:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43631 X-GNU-PR-Package: emacs Original-Received: via spool by 43631-submit@debbugs.gnu.org id=B43631.16013216159140 (code B ref 43631); Mon, 28 Sep 2020 19:34:02 +0000 Original-Received: (at 43631) by debbugs.gnu.org; 28 Sep 2020 19:33:35 +0000 Original-Received: from localhost ([127.0.0.1]:54048 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMytz-0002NM-2U for submit@debbugs.gnu.org; Mon, 28 Sep 2020 15:33:35 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:31450 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1kMytv-0002N7-SH for 43631@debbugs.gnu.org; Mon, 28 Sep 2020 15:33:33 -0400 Original-Received: (qmail 74652 invoked by uid 3782); 28 Sep 2020 19:33:25 -0000 Original-Received: from acm.muc.de (p4fe159a9.dip0.t-ipconnect.de [79.225.89.169]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Mon, 28 Sep 2020 21:33:24 +0200 Original-Received: (qmail 28168 invoked by uid 1000); 28 Sep 2020 19:33:25 -0000 Content-Disposition: inline In-Reply-To: <87pn67312v.fsf@thornhill.no> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de 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:189222 Archived-At: Hello, Theo. On Sun, Sep 27, 2020 at 13:34:32 +0200, Theodor Thornhill wrote: > Eli Zaretskii writes: > [...] > > But I'm confused why the "fast" profile starts with > > font-lock-fontify-region, whereas the "slow" profile doesn't have > > font-lock-fontify-region anywhere... > I see that when I remove 'c-before-change-check-unbalanced-strings from > 'c-get-state-before-change-functions' the performance degradation > ceases. I'm not sure what else is affected by that change, so not sure > if that can be counted as a fix as far as 'csharp-mode' is concerned. I would strongly recommend you not to make such a change, at least not without a good deal of matching changes elsewhere. ;-) It seems the bit in c-b-c-check-unbalanced-strings dealing with multiline strings was written on the assumption that buffers containing such would be small. With multiline strings, _any_ change involving quote characters can flip the string/non-string characterisation from point all the way to the end of the buffer. In the worst case scenario, this potentially big region needs to be analysed and have syntax-table text properties throughout the entire region changed. The current problem is that c-b-c-check-u-strings is doing this analysis for every buffer change. This was easier to code, but has led to performance problems on buffers which aren't small. The solution to this will have to involve restricting this analysis to when quote marks or the c-multiline-string-start-char get inserted or removed. That way, there should only be an occasional and tolerable delay when one of these characters is inserted/removed. I'll be looking at this in the coming days. > Just wanted to let you know. > Theo -- Alan Mackenzie (Nuremberg, Germany).