From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 26 07:17:38 2020 Received: (at submit) by debbugs.gnu.org; 26 Sep 2020 11:17:38 +0000 Received: from localhost ([127.0.0.1]:45961 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kM8Cv-0006ww-S8 for submit@debbugs.gnu.org; Sat, 26 Sep 2020 07:17:38 -0400 Received: from lists.gnu.org ([209.51.188.17]:42348) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kM8Cr-0006wm-86 for submit@debbugs.gnu.org; Sat, 26 Sep 2020 07:17:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58786) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kM8Cq-0005X5-Uh for bug-gnu-emacs@gnu.org; Sat, 26 Sep 2020 07:17:33 -0400 Received: from out1.migadu.com ([2001:41d0:2:863f::]:37760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kM8Cm-0004qZ-Pr for bug-gnu-emacs@gnu.org; Sat, 26 Sep 2020 07:17:32 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1601119045; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=FR5GZPaZ8C4dz/HWAdha/gZmqev8RZP+oavGs9toxcE=; b=dAWpOOUU1qPE/kDU/sKZKIXEHQ/WLxnpiAy9FWLdqHDAmpddlRr5GSnMAdncFLTFW9yxY4 9kf5P7s7mxa7M3iBXwlwDVo9IVMX0m8xQgiVqi+kY+O97bmIt1UPBlXChioen7UNLG68Dg tR1QAcZki2uzc2qjpQyCbPXGnYgmVgmEpzcbdsf+foAraF2d7adMbUH++2QIAs/gB8GdsQ uhXH+Kib5Rlf9cnaPoyMMywkdsi8DESn3RCCQE8UX+mB9Si8M1ikKaJwAjaPog28lgyLIZ zEaKHsSzxfMczKvofzf/jlpzdXm6+Lo8I5hWuieR5TqG1Jvm3i+g5BAC49fzpA== From: Theodor Thornhill To: bug-gnu-emacs@gnu.org Subject: 28.0.50; CC Mode multiline strings grinds performance to a halt Date: Sat, 26 Sep 2020 13:17:29 +0200 Message-ID: <87lfgwwzw6.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.10 Received-SPF: pass client-ip=2001:41d0:2:863f::; envelope-from=theo@thornhill.no; helo=out1.migadu.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/26 07:17:26 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Hello there! While creating a new mode derived from CC Mode, we noticed performance is affected heavily when setting a character for 'c-multiline-string-start-char'. There is a discussion around this that can be found at https://github.com/josteink/csharp-mode/issues/164, and we were given an easily reproducible repo for this. It is verified to slow typing down both in 'csharp-mode', 'pike-mode' and in this test case: https://github.com/unhammer/csharp-mode/tree/164-repro I think (unconvincingly) that some of the problematic code is situated around line 2047 in 'cc-mode.el', but this is only a guess taken from some light profiling. The issue is described well on github, and I think me trying to reiterate that here will only cause subtle confusions. One thing of note is that you don't even have to have any multiline strings for this performance hit to occur, meaning all 'csharp-mode' files do suffer from this. Let me know if something is still unclear, and I'll try to bring up some more information. All the best, Theodor Thornhill From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 26 07:41:16 2020 Received: (at 43631) by debbugs.gnu.org; 26 Sep 2020 11:41:16 +0000 Received: from localhost ([127.0.0.1]:45987 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kM8Zn-0001DP-PI for submit@debbugs.gnu.org; Sat, 26 Sep 2020 07:41:15 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54362) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kM8Zl-0001DA-4p for 43631@debbugs.gnu.org; Sat, 26 Sep 2020 07:41:14 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:59199) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kM8Ze-000706-U7; Sat, 26 Sep 2020 07:41:07 -0400 Received: from [176.228.60.248] (port=3399 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kM8Ze-0005mq-8z; Sat, 26 Sep 2020 07:41:06 -0400 Date: Sat, 26 Sep 2020 14:41:19 +0300 Message-Id: <83pn68rcio.fsf@gnu.org> From: Eli Zaretskii To: Theodor Thornhill In-Reply-To: <87lfgwwzw6.fsf@thornhill.no> (bug-gnu-emacs@gnu.org) Subject: Re: bug#43631: 28.0.50; CC Mode multiline strings grinds performance to a halt References: <87lfgwwzw6.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 43631 Cc: 43631@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 26 Sep 2020 13:17:29 +0200 > From: Theodor Thornhill via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > While creating a new mode derived from CC Mode, we noticed performance > is affected heavily when setting a character for > 'c-multiline-string-start-char'. There is a discussion around this that > can be found at https://github.com/josteink/csharp-mode/issues/164, > and we were given an easily reproducible repo for this. It is verified > to slow typing down both in 'csharp-mode', 'pike-mode' and in this test > case: > https://github.com/unhammer/csharp-mode/tree/164-repro > > I think (unconvincingly) that some of the problematic code is situated > around line 2047 in 'cc-mode.el', but this is only a guess taken from > some light profiling. All the profiles posted there end prematurely, thus making it impossible to make independent conclusions regarding the possible culprits. Would it be possible to post here a full profile, completely expanded, obtained after loading all the relevant *.el files as *.el (NOT *.elc!), so that the profile is detailed enough to show the relevant parts? It would make the discussion much more focused. Bonus points for posting another profile, where the feature you think is the main culprit is disabled. TIA From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 26 08:40:36 2020 Received: (at 43631) by debbugs.gnu.org; 26 Sep 2020 12:40:36 +0000 Received: from localhost ([127.0.0.1]:46026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kM9VD-0002dF-Qm for submit@debbugs.gnu.org; Sat, 26 Sep 2020 08:40:36 -0400 Received: from out1.migadu.com ([91.121.223.63]:11516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kM9VA-0002d5-Tc for 43631@debbugs.gnu.org; Sat, 26 Sep 2020 08:40:34 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1601124031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=93Kat2P16RhR+BkzJ1BWgPmytHHA7dHanqs58EFA2DI=; b=mS0BSJIiWFbZsU+iIs3u/vIbKlavVvxf1YjSNGLJM5DJzS5KhamWXOQDKXO0QCjYZb0vql INgCz0VGYy6bsQHR90vvJe8g+8UD5duuDC+K/ReT+ql9O8Foajqh1dB3v+nIoICCf0P13v rxZtom+8Vv8sBwQ4TDmek+nVbPyVfpbnuooOIwrFBXpL0xwSYKGQDmydkIfsQJnOce3QKf Ko/4T0HUK3NIoK7Evb+LaSlVJ6ZCwVmt8ttHOFU/hINHbAThhxOKXmZhRqtGJ+Ynd2BWyD AUmUthOfgc1wMeyER5jmybYfqPnOLAHrxExRy1/q94DNGvwFILU/087nEMbw0w== From: Theodor Thornhill To: Eli Zaretskii Subject: Re: bug#43631: 28.0.50; CC Mode multiline strings grinds performance to a halt In-Reply-To: <83pn68rcio.fsf@gnu.org> References: <87lfgwwzw6.fsf@thornhill.no> <83pn68rcio.fsf@gnu.org> Date: Sat, 26 Sep 2020 14:40:36 +0200 Message-ID: <87eemo4sor.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.90 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 43631 Cc: 43631@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: > All the profiles posted there end prematurely, thus making it > impossible to make independent conclusions regarding the possible > culprits. Would it be possible to post here a full profile, > completely expanded, obtained after loading all the relevant *.el > files as *.el (NOT *.elc!), so that the profile is detailed enough to > show the relevant parts? It would make the discussion much more > focused. > > Bonus points for posting another profile, where the feature you think > is the main culprit is disabled. > > TIA Attached is two reports, one which is super slow, and one that is fast. Recipe: - git clone https://github.com/unhammer/csharp-mode/ - git checkout 164-repro - eval csharp-mode.el - open superslow.cs and write some text - rinse, repeat, but with (c-lang-defconst c-multiline-string-start-char csharp ?@) commented out. One is unbearably slow, the other is super fast. Hope this helps a little! All the best, Theodor Thornhill --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=not-slow-without-multiline.txt Content-Transfer-Encoding: quoted-printable [profiler-profile "24.3" cpu #s(hash-table size 65 test equal rehash-size 1= .5 rehash-threshold 0.8125 data ([redisplay sit-for execute-extended-comman= d funcall-interactively call-interactively command-execute nil nil nil nil = nil nil nil nil nil nil] 1 [progn unwind-protect let and if save-restrictio= n if progn if let c-beginning-of-macro and let* progn unwind-protect let*] = 1 [nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil] 17 [fon= t-lock-fontify-syntactically-region font-lock-default-fontify-region funcal= l progn unwind-protect let* progn unwind-protect let* let save-restriction = c-font-lock-fontify-region font-lock-fontify-region "#" run-hook-wrapped jit-lock--run-functions] 1 [progn cond let* save-= excursion progn unwind-protect let c-invalidate-sws-region-before save-excu= rsion progn unwind-protect progn unwind-protect let save-restriction if] 1 = [self-insert-command funcall-interactively call-interactively command-execu= te nil nil nil nil nil nil nil nil nil nil nil nil] 1 [save-restriction pro= gn if c-extend-after-change-region font-lock-extend-jit-lock-region-after-c= hange run-hook-with-args jit-lock-after-change self-insert-command funcall-= interactively call-interactively command-execute nil nil nil nil nil] 1 [re= ad-from-minibuffer completing-read-default completing-read read-extended-co= mmand byte-code call-interactively command-execute nil nil nil nil nil nil = nil nil nil] 2 [completing-read-default completing-read read-extended-comma= nd byte-code call-interactively command-execute nil nil nil nil nil nil nil= nil nil nil] 2 [Automatic\ GC] 11)) (24431 13788 861111 419000) nil] --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=report-slow-with-multiline.txt Content-Transfer-Encoding: quoted-printable [profiler-profile "24.3" cpu #s(hash-table size 65 test equal rehash-size 1= .5 rehash-threshold 0.8125 data ([sit-for execute-extended-command funcall-= interactively call-interactively command-execute nil nil nil nil nil nil ni= l nil nil nil nil] 1 [progn while let* c-pps-to-string-delim progn and whil= e progn if cond let* progn unwind-protect let* c-before-change-check-unbala= nced-strings funcall] 1212 [setq cond progn and while condition-case let c-= syntactic-re-search-forward and while progn and while progn if cond] 1 [c-p= ps-to-string-delim progn and while progn if cond let* progn unwind-protect = let* c-before-change-check-unbalanced-strings funcall "#" mapc if] 2 [unwind-protect let save-excursion cond progn and while c= ondition-case let c-syntactic-re-search-forward and while progn and while p= rogn] 1 [remove-text-properties progn if while let c-clear-char-property-wi= th-value-on-char-function progn if let* progn unwind-protect let* c-parse-q= uotes-before-change funcall "#" mapc] 1 [progn whil= e let* c-pps-to-string-delim cond let* progn unwind-protect let* c-before-c= hange-check-unbalanced-strings funcall "#" mapc if = save-excursion progn] 3 [progn and while progn and while progn if cond let*= progn unwind-protect let* c-before-change-check-unbalanced-strings funcall= "#"] 2 [setq progn and while condition-case let c-= syntactic-re-search-forward and while progn and while progn if cond let*] 1= [progn and while condition-case let c-syntactic-re-search-forward and whil= e progn and while progn if cond let* progn] 1 [setq while progn if let save= -restriction save-excursion c-parse-ps-state-below setq progn if let* progn= unwind-protect let save-restriction] 2 [nil nil nil nil nil nil nil nil ni= l nil nil nil nil nil nil nil] 2 [set-match-data unwind-protect let progn i= f save-restriction if progn if let c-beginning-of-macro progn unwind-protec= t let save-excursion cond] 1 [let if c-invalidate-state-cache-1 if c-invali= date-state-cache cond while save-restriction let* progn unwind-protect let*= c-parse-quotes-after-change funcall "#" mapc] 2 [= if if while let* progn unwind-protect let* if c-after-change-mark-abnormal-= strings funcall "#" mapc save-excursion progn unwi= nd-protect progn] 5 [goto-char let* c-pps-to-string-delim progn and while p= rogn if cond let* progn unwind-protect let* c-before-change-check-unbalance= d-strings funcall "#"] 1 [if progn and while condit= ion-case let c-syntactic-re-search-forward and while progn and while progn = if cond let*] 4 [and if progn while progn unwind-protect let progn if save-= restriction if progn if let c-beginning-of-macro progn] 2 [if progn if let = c-beginning-of-macro progn unwind-protect let save-excursion cond progn and= while condition-case let c-syntactic-re-search-forward] 2 [save-restrictio= n if progn if let c-beginning-of-macro progn unwind-protect let save-excurs= ion cond progn and while condition-case let] 2 [let and if save-restriction= if progn if let c-beginning-of-macro progn unwind-protect let save-excursi= on cond progn and] 2 [cond progn and while condition-case let c-syntactic-r= e-search-forward and while progn and while progn if cond let*] 1 [and if le= t c-backward-sws c-determine-limit-get-base let* save-excursion c-determine= -limit setq if let c-fl-decl-start or setq if c-change-expand-fl-region] 1 = [let* c-pps-to-string-delim progn and while progn if cond let* progn unwind= -protect let* c-before-change-check-unbalanced-strings funcall "#" mapc] 1 [assq cdr looking-at if if while let* progn unwind-= protect let* if c-after-change-mark-abnormal-strings funcall "#" mapc save-excursion] 1 [let c-syntactic-re-search-forward an= d while progn and while progn if cond let* progn unwind-protect let* c-befo= re-change-check-unbalanced-strings funcall] 1 [setq c-truncate-lit-pos-cach= e c-clear-syn-tab progn and while progn and while progn if cond let* progn = unwind-protect let*] 1 [c-clear-syn-tab if progn while let* c-pps-to-string= -delim progn and while progn if cond let* progn unwind-protect let*] 2 [cha= r-before eq while progn while progn unwind-protect let progn if save-restri= ction if progn if let c-beginning-of-macro] 1 [c-syntactic-re-search-forwar= d and while progn and while progn if cond let* progn unwind-protect let* c-= before-change-check-unbalanced-strings funcall "#"]= 2 [setq c-truncate-lit-pos-cache c-invalidate-state-cache-1 if c-invalidat= e-state-cache cond while save-restriction let* progn unwind-protect let* c-= parse-quotes-after-change funcall "#" mapc] 1 [and= while save-restriction let* progn unwind-protect let* c-parse-quotes-after= -change funcall "#" mapc save-excursion progn unwi= nd-protect progn unwind-protect] 1 [not save-excursion cond while save-rest= riction let* progn unwind-protect let* c-parse-quotes-after-change funcall = "#" mapc save-excursion progn unwind-protect] 1 [s= etq progn while progn and while let* progn unwind-protect let* if c-after-c= hange-mark-abnormal-strings funcall "#" mapc save-= excursion] 1 [c-truncate-lit-pos-cache c-invalidate-state-cache-1 if c-inva= lidate-state-cache cond while save-restriction let* progn unwind-protect le= t* c-parse-quotes-after-change funcall "#" mapc sa= ve-excursion] 1 [save-excursion cond progn and while condition-case let c-s= yntactic-re-search-forward and while progn and while progn if cond] 1 [unwi= nd-protect let and if save-restriction if progn if let c-beginning-of-macro= progn unwind-protect let save-excursion cond progn] 1 [while let* progn un= wind-protect let* if c-after-change-mark-abnormal-strings funcall "#" mapc save-excursion progn unwind-protect progn unwind-p= rotect let] 1 [completing-read-default completing-read read-extended-comman= d byte-code call-interactively command-execute nil nil nil nil nil nil nil = nil nil nil] 4 [Automatic\ GC] 73)) (24431 13704 63591 401000) nil] --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 26 09:43:18 2020 Received: (at 43631) by debbugs.gnu.org; 26 Sep 2020 13:43:19 +0000 Received: from localhost ([127.0.0.1]:46133 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMATu-00048s-Mp for submit@debbugs.gnu.org; Sat, 26 Sep 2020 09:43:18 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43664) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMATs-00048c-8o for 43631@debbugs.gnu.org; Sat, 26 Sep 2020 09:43:16 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:60178) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMATm-0002rS-94; Sat, 26 Sep 2020 09:43:10 -0400 Received: from [176.228.60.248] (port=2961 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kMATl-0003ML-H3; Sat, 26 Sep 2020 09:43:09 -0400 Date: Sat, 26 Sep 2020 16:43:05 +0300 Message-Id: <83o8lsr6vq.fsf@gnu.org> From: Eli Zaretskii To: Theodor Thornhill In-Reply-To: <87eemo4sor.fsf@thornhill.no> (message from Theodor Thornhill on Sat, 26 Sep 2020 14:40:36 +0200) Subject: Re: bug#43631: 28.0.50; CC Mode multiline strings grinds performance to a halt References: <87lfgwwzw6.fsf@thornhill.no> <83pn68rcio.fsf@gnu.org> <87eemo4sor.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 43631 Cc: 43631@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Theodor Thornhill > Cc: 43631@debbugs.gnu.org > Date: Sat, 26 Sep 2020 14:40:36 +0200 > > Eli Zaretskii writes: > > > All the profiles posted there end prematurely, thus making it > > impossible to make independent conclusions regarding the possible > > culprits. Would it be possible to post here a full profile, > > completely expanded, obtained after loading all the relevant *.el > > files as *.el (NOT *.elc!), so that the profile is detailed enough to > > show the relevant parts? It would make the discussion much more > > focused. > > > > Bonus points for posting another profile, where the feature you think > > is the main culprit is disabled. > > > > TIA > > > Attached is two reports, one which is super slow, and one that is fast. Thanks, but please post the text of Profiler-Report buffer, not the internal structure it produces. From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 26 12:03:12 2020 Received: (at 43631) by debbugs.gnu.org; 26 Sep 2020 16:03:12 +0000 Received: from localhost ([127.0.0.1]:47626 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMCfI-0007zv-7G for submit@debbugs.gnu.org; Sat, 26 Sep 2020 12:03:12 -0400 Received: from out1.migadu.com ([91.121.223.63]:25340) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMCfD-0007zi-VX for 43631@debbugs.gnu.org; Sat, 26 Sep 2020 12:03:10 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1601136186; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=44JydAX6wkLdC7ktbzw9JUSVA+i7foehFoAkEvD1Yas=; b=rdDzkLUK651SJ3TUADVYIVvbw4KRFNMmTpgQlbMRmiyIlXAIQS7cwE6yr+lFETiIMH/YPI vp02KK6RtlnPPar7gsaqxDyMiTKAKNroLCqugwKzVOtoi2xVfjePmRxMW9jwkC/9pKOnYF noXmcf0UB7VD6mdHgavQTdEQ6rSvFTn4Xu4qrh3ac5eUf5EWLtXihIUZgKhUMHKC48de1J vI+FxdS/lBejTsNrxENzzYWpoy5AHbHqdmVpLeFB6N3GBS7ga9o5jL09iJCifEOujQqM6I uzu1N6fDRBNDEjgDJ1/YfAxwiOyGWGv/l2XomB7DqgCQGLNGFK8os/EGj3z0kg== From: Theodor Thornhill To: Eli Zaretskii Subject: Re: bug#43631: 28.0.50; CC Mode multiline strings grinds performance to a halt In-Reply-To: <83o8lsr6vq.fsf@gnu.org> References: <87lfgwwzw6.fsf@thornhill.no> <83pn68rcio.fsf@gnu.org> <87eemo4sor.fsf@thornhill.no> <83o8lsr6vq.fsf@gnu.org> Date: Sat, 26 Sep 2020 18:03:10 +0200 Message-ID: <877dsgle4h.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.90 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 43631 Cc: 43631@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: [...] >> >> Attached is two reports, one which is super slow, and one that is fast. > > Thanks, but please post the text of Profiler-Report buffer, not the > internal structure it produces. Ok, third time's the charm: recipe same as before. Theodor Thornhill --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=fast-without-multiline.txt - ... 16 84% Automatic GC 7 36% - # 6 31% - font-lock-fontify-region 6 31% - c-font-lock-fontify-region 6 31% - save-restriction 6 31% - let 6 31% - let* 6 31% - unwind-protect 5 26% - progn 5 26% - let* 5 26% - unwind-protect 5 26% - progn 5 26% - if 5 26% - while 3 15% - if 2 10% - progn 2 10% - cond 2 10% - and 2 10% - save-excursion 2 10% - c-backward-sws 2 10% - let 2 10% - if 2 10% - progn 2 10% - let* 2 10% - unwind-protect 2 10% - progn 2 10% - while 2 10% - progn 2 10% while 1 5% - cond 1 5% - and 1 5% - c-beginning-of-macro 1 5% - let 1 5% - if 1 5% - progn 1 5% - if 1 5% - save-restriction 1 5% back-to-indentation 1 5% - and 1 5% - progn 1 5% - and 1 5% - or 1 5% - and 1 5% - save-excursion 1 5% - consp 1 5% - c-looking-at-or-maybe-in-bracelist 1 5% - save-excursion 1 5% - let 1 5% - setq 1 5% - c-backward-token-2 1 5% - if 1 5% let 1 5% - setq 2 10% - or 1 5% - c-fl-decl-start 1 5% - let 1 5% - if 1 5% - setq 1 5% - c-determine-limit 1 5% - save-excursion 1 5% - let* 1 5% - c-determine-limit-get-base 1 5% - c-backward-sws 1 5% - let 1 5% - if 1 5% - progn 1 5% - let* 1 5% unwind-protect 1 5% - c-before-context-fl-expand-region 1 5% - save-restriction 1 5% save-excursion 1 5% - c-literal-limits 1 5% - save-excursion 1 5% - let* 1 5% - if 1 5% - let* 1 5% - c-full-pp-to-literal 1 5% - save-excursion 1 5% - save-restriction 1 5% - let 1 5% - unwind-protect 1 5% - progn 1 5% - let* 1 5% - if 1 5% - progn 1 5% setq 1 5% - minibuffer-complete 2 10% - completion-in-region 2 10% - completion--in-region 2 10% - # 2 10% - apply 2 10% - # 2 10% - completion--in-region-1 2 10% - completion--do-completion 2 10% - completion-try-completion 2 10% - completion--nth-completion 2 10% - completion--some 2 10% - # 2 10% - completion-basic-try-completion 2 10% - try-completion 2 10% - # 2 10% complete-with-action 2 10% - self-insert-command 1 5% - c-before-change 1 5% - if 1 5% - save-restriction 1 5% - let 1 5% - unwind-protect 1 5% - progn 1 5% - unwind-protect 1 5% - progn 1 5% - save-excursion 1 5% - c-unfind-enclosing-token 1 5% - save-excursion 1 5% - let 1 5% - progn 1 5% - and 1 5% c-end-of-current-token 1 5% + command-execute 2 10% + timer-event-handler 1 5% --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=slow-with-multiline.txt - ... 1500 99% - c-before-change 1420 94% - if 1420 94% - save-restriction 1420 94% - let 1420 94% - unwind-protect 1420 94% - progn 1420 94% - unwind-protect 1418 94% - progn 1418 94% - save-excursion 1418 94% - if 1403 93% - mapc 1403 93% - # 1403 93% - funcall 1403 93% - c-before-change-check-unbalanced-strings 1400 93% - let* 1400 93% - unwind-protect 1400 93% - progn 1400 93% - let* 1400 93% - cond 1400 93% - if 1398 93% - progn 1398 93% - while 1398 93% - and 1398 93% - progn 1398 93% - c-pps-to-string-delim 1372 91% - let* 1371 91% - while 1367 90% - progn 1366 90% - if 4 0% - c-clear-syn-tab 3 0% let 1 0% - cons 2 0% - cons 2 0% - cons 2 0% - cons 1 0% - cons 1 0% - cons 1 0% - cons 1 0% cons 1 0% - while 25 1% - and 25 1% - c-syntactic-re-search-forward 23 1% - let 22 1% - condition-case 22 1% - while 22 1% - and 22 1% - progn 22 1% - cond 16 1% - save-excursion 15 0% - let 15 0% - unwind-protect 13 0% - progn 13 0% - c-beginning-of-macro 13 0% - let 13 0% - if 9 0% - progn 9 0% - if 9 0% - save-restriction 8 0% - if 6 0% - progn 3 0% - let 3 0% - unwind-protect 3 0% - progn 3 0% - while 3 0% - progn 3 0% - if 3 0% and 2 0% - and 3 0% - let 3 0% - unwind-protect 1 0% progn 1 0% if 3 0% setq 2 0% - progn 2 0% - c-clear-syn-tab 2 0% - let 1 0% setq 1 0% memq 1 0% - c-pps-to-string-delim 2 0% - let* 2 0% - while 2 0% progn 2 0% - c-parse-quotes-before-change 2 0% - let* 2 0% - unwind-protect 2 0% - progn 2 0% - let* 2 0% - if 2 0% - progn 2 0% - c-clear-char-property-with-value-on-char-function 2 0% - let 2 0% - while 2 0% - if 2 0% progn 2 0% - c-extend-region-for-CPP 1 0% - if 1 0% c-beginning-of-macro 1 0% - mapc 15 0% - # 15 0% - funcall 15 0% - c-parse-quotes-after-change 9 0% - let* 9 0% - unwind-protect 9 0% - progn 9 0% - let* 9 0% - save-restriction 9 0% - while 9 0% - cond 8 0% - c-invalidate-state-cache 6 0% - if 6 0% - c-invalidate-state-cache-1 6 0% - if 5 0% - let 5 0% save-excursion 3 0% - setq 1 0% - or 1 0% - if 1 0% and 1 0% - c-truncate-lit-pos-cache 1 0% setq 1 0% let 1 0% - c-after-change-mark-abnormal-strings 5 0% - if 5 0% - let* 4 0% - unwind-protect 4 0% - progn 4 0% - let* 4 0% - while 4 0% - if 2 0% - if 1 0% - looking-at 1 0% - cdr 1 0% assq 1 0% - and 2 0% - progn 2 0% - while 2 0% - progn 2 0% - setq 2 0% parse-partial-sexp 1 0% - setq 1 0% - or 1 0% - c-fl-decl-start 1 0% - let 1 0% - if 1 0% - setq 1 0% - c-determine-limit 1 0% - save-excursion 1 0% - let* 1 0% - c-determine-limit-get-base 1 0% - let* 1 0% - c-semi-pp-to-literal 1 0% - save-excursion 1 0% - save-restriction 1 0% let 1 0% - c-neutralize-syntax-in-CPP 1 0% - let* 1 0% - unwind-protect 1 0% - progn 1 0% - let* 1 0% - let 1 0% - while 1 0% and 1 0% - let* 2 0% - if 2 0% - progn 2 0% - setq 2 0% - c-parse-ps-state-below 2 0% - save-excursion 2 0% - save-restriction 2 0% - let 2 0% - if 2 0% - progn 2 0% - while 2 0% setq 2 0% Automatic GC 79 5% - c-backward-sws 1 0% - let 1 0% - if 1 0% - progn 1 0% - let* 1 0% - unwind-protect 1 0% - progn 1 0% - while 1 0% - progn 1 0% - c-backward-comments 1 0% - let 1 0% - while 1 0% - and 1 0% - if 1 0% - if 1 0% and 1 0% + command-execute 3 0% --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 26 12:17:20 2020 Received: (at 43631) by debbugs.gnu.org; 26 Sep 2020 16:17:20 +0000 Received: from localhost ([127.0.0.1]:47658 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMCsy-0008Ll-Cx for submit@debbugs.gnu.org; Sat, 26 Sep 2020 12:17:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39618) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMCsw-0008LZ-EE for 43631@debbugs.gnu.org; Sat, 26 Sep 2020 12:17:19 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34236) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kMCsr-0006OW-1p; Sat, 26 Sep 2020 12:17:13 -0400 Received: from [176.228.60.248] (port=4634 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kMCsn-0006KU-AP; Sat, 26 Sep 2020 12:17:11 -0400 Date: Sat, 26 Sep 2020 19:17:06 +0300 Message-Id: <837dsgqzr1.fsf@gnu.org> From: Eli Zaretskii To: Theodor Thornhill In-Reply-To: <877dsgle4h.fsf@thornhill.no> (message from Theodor Thornhill on Sat, 26 Sep 2020 18:03:10 +0200) Subject: Re: bug#43631: 28.0.50; CC Mode multiline strings grinds performance to a halt References: <87lfgwwzw6.fsf@thornhill.no> <83pn68rcio.fsf@gnu.org> <87eemo4sor.fsf@thornhill.no> <83o8lsr6vq.fsf@gnu.org> <877dsgle4h.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 43631 Cc: 43631@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Theodor Thornhill > Cc: 43631@debbugs.gnu.org > Date: Sat, 26 Sep 2020 18:03:10 +0200 > > > Thanks, but please post the text of Profiler-Report buffer, not the > > internal structure it produces. > > Ok, third time's the charm: Thanks. This seems to indicate that this loop in c-pps-to-string-delim is the culprit: (while (progn (parse-partial-sexp (point) end nil nil st-s 'syntax-table) (unless (bobp) (c-clear-syn-tab (1- (point)))) (setq st-pos (point)) (and (< (point) end) (not (eq (char-before) ?\"))))) 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... Hopefully, Alan can take it from here. From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 26 15:43:16 2020 Received: (at 43631) by debbugs.gnu.org; 26 Sep 2020 19:43:16 +0000 Received: from localhost ([127.0.0.1]:47784 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMG6F-0006rf-Sz for submit@debbugs.gnu.org; Sat, 26 Sep 2020 15:43:16 -0400 Received: from mail-wr1-f44.google.com ([209.85.221.44]:42864) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMG6D-0006rQ-RZ for 43631@debbugs.gnu.org; Sat, 26 Sep 2020 15:43:14 -0400 Received: by mail-wr1-f44.google.com with SMTP id c18so7478985wrm.9 for <43631@debbugs.gnu.org>; Sat, 26 Sep 2020 12:43:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=SC1YIhip+iZZcZclWjfAVy8XJN2VYV3d0XzkC46xeJ0=; b=t3DbCm8pb6ziuX+a2GKt+fJOP/0DgEHSctZFhMDJhg6CmXg0XDYyCE4Jl4TtpzpnjS Ump/D+hDjG6zoBXoku0/MG+pEReekl94tjDrq9wnj40oeWtYM23jYZsHY4YXwuNt+/9X nlQrAlPfGMx771T56tixjS553JPvQGntqJmPQcrufP/SNvz/OaUyA3y8OXfokwjn5mK5 941A3K4C9LFd+0Zi4N1mA/+M7WIq1eWHOj2UVq2ipfNTj3Gmm1hLZcefHrEAec+/1Ss5 3TEbJBuckl90MG+2i7mtbdkB7MmltfOouQiQOoCEu2wUrprB/kkHD/+0SNvytr2Xvo6z e+lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=SC1YIhip+iZZcZclWjfAVy8XJN2VYV3d0XzkC46xeJ0=; b=biKrdwfofAyYRaKwZRHAegTZgultpZ4DXXoW6P79hdAmm+WdqH5vn19Tg0sOKEw+9z zdZ00SxeJlFuS2X5zwoA1nPMQs5CA3Zey4nmQMVLcP2wNAdYw7ACJjHJDSjtzPoHK3/R j59H8kkAoHAlDj4pLMxzAvTLJ+Vux0/6wiistHCqhQEIcJlCP84kRGBjyhLJi1bWacwc ijO72Zctofu/7GpuH3bVQV6QZ77D5j6ZtHxcnRSgE82NOHGDRz9BI8uHFoE9cWzXmPNM 3GR98RbpORRUwgvd4hLIOM7+3utWRrI4anhi08m+z9knR6vlqJ1RY9VdDO0l0ILSFlqn 48fQ== X-Gm-Message-State: AOAM530Y+C1gEfWsmXMVM4PiI+YoS3gfdOUUoA00pBflGE7cin0G+cGk mohyYFPt8lmBxiyxFjN9qO67HlXDtJQmEg== X-Google-Smtp-Source: ABdhPJw2uDAHkKMMukF757FCFZeRtH0a2iyivkir08skzh/r321VIDFlHvPk/T7LEZAQK4XS41H7pA== X-Received: by 2002:adf:dccc:: with SMTP id x12mr10981449wrm.241.1601149387536; Sat, 26 Sep 2020 12:43:07 -0700 (PDT) Received: from [192.168.0.4] ([66.205.71.3]) by smtp.googlemail.com with ESMTPSA id k4sm7367319wrx.51.2020.09.26.12.43.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 26 Sep 2020 12:43:06 -0700 (PDT) Subject: Re: bug#43631: 28.0.50; CC Mode multiline strings grinds performance to a halt To: Eli Zaretskii , Theodor Thornhill 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> From: Dmitry Gutov Message-ID: Date: Sat, 26 Sep 2020 22:43:05 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <837dsgqzr1.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 43631 Cc: 43631@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 26.09.2020 19:17, Eli Zaretskii wrote: > 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... Because CC Mode doesn't use syntax-propertize-function (most major modes do, so we're used to seeing "slow" syntax analysis being done inside font-lock-fontify-region because it calls s-p-f). CC Mode applies syntax properties inside before/after-change-functions, and the "slow" profile reflects that: c-before-change is featured prominently. From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 27 05:55:28 2020 Received: (at 43631) by debbugs.gnu.org; 27 Sep 2020 09:55:28 +0000 Received: from localhost ([127.0.0.1]:48358 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMTOx-0006Tw-Vi for submit@debbugs.gnu.org; Sun, 27 Sep 2020 05:55:28 -0400 Received: from out0.migadu.com ([94.23.1.103]:43274) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMTOv-0006Tm-5T for 43631@debbugs.gnu.org; Sun, 27 Sep 2020 05:55:26 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1601200523; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RA4OJSZxKtBjxOhQM0+7uqiIGHMhG1TnUbmziz+FrN8=; b=nzb6LITj4aG3KyVIbbL1VJu84bqGFcsRnZz3CZB1NrG7wJni+WjzDPA+GajPozPUbRM+iM rUaenycAT29WYdc2hQW2BDJCpFKLgwac6AWXP8AEqK/+QLbdMo31Ll0eIYT8ukPSAGCHla SSzmwBRzqa1Eiohf/bCc31fMC7EwtPW8Y1DupI8SiNkbZpvH5LJQlDpi3lsKgrrZS8TUjy 7ktLycBjtQMxehxpubm5lDR10XsLUfdMouBgx99tcZH4Om7tGSz0aEz9Wio1U4bCHtRgCb ceRIs3qcMD+X8Nr5DLlZsfJAnmywOzCjbPncmRCirWKYOW7IUTevPinLxWSjJA== From: Theodor Thornhill To: Eli Zaretskii Subject: Re: bug#43631: 28.0.50; CC Mode multiline strings grinds performance to a halt In-Reply-To: <837dsgqzr1.fsf@gnu.org> 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> Date: Sun, 27 Sep 2020 11:54:23 +0200 Message-ID: <87v9fz4ka8.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.10 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 43631 Cc: 43631@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: [...] > > Thanks. This seems to indicate that this loop in > c-pps-to-string-delim is the culprit: > > (while (progn > (parse-partial-sexp (point) end nil nil st-s 'syntax-table) > (unless (bobp) > (c-clear-syn-tab (1- (point)))) > (setq st-pos (point)) > (and (< (point) end) > (not (eq (char-before) ?\"))))) > > 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... > Thanks for digging into this. I can add one more thing that I see. When this variable is set to some char, typing that character and then quote mark would only insert one quote and fontify to end of buffer as a string. Example: - type @" // (#") for pike-mode - see whole buffer get fontified - no extra quote mark is inserted to make a proper pair. What I would expect: - type @" - see @"" - type normally inside quote marks. I am not sure how this is related, if at all, but found it noticeable enough to add to this discussion. Also, if the 'multiline-string' variable is not set, typing @" would behave as expected, with the pair being closed and nothing other than string is fontified. > Hopefully, Alan can take it from here. Theo From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 27 07:35:35 2020 Received: (at 43631) by debbugs.gnu.org; 27 Sep 2020 11:35:36 +0000 Received: from localhost ([127.0.0.1]:48512 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMUxr-0002qw-N1 for submit@debbugs.gnu.org; Sun, 27 Sep 2020 07:35:35 -0400 Received: from out1.migadu.com ([91.121.223.63]:37198) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMUxp-0002qn-0A for 43631@debbugs.gnu.org; Sun, 27 Sep 2020 07:35:35 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1601206531; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=j22ESYo65U0vLAurXLcqg4FX8bT35etKpDdbR9wHnAI=; b=HtFHDHFklsV/NHnGoQ6CKod6zv0HaSsmiCcY96KBUZFVhZ05wkRBBmwWeMOoKBA5aBLSAG wD97zs/FeOyVSDmg1L0u4dvf01hheiQO52nnJD983ry0P1dBhapMH90FlRS6IBCorrc9Q/ pnF4LTYgCuAJAaeaHEtI27GbZPyIripX4++9zkH3JN46AYDweckcQx75R/dKAlUWFiEXIO KiZCDbAYOiRCcVmiSjaVUzZQHi8ZiNpTu3ZViB6aR4fmrfPRHJpS/YZElVeIkxi2Q1/U4Y xTzUaHCO+wOAb4ycWp2F80zsgVhoCWeM65TQHtohOzVSbnR/ofi9e2O9cmb7hg== From: Theodor Thornhill To: Eli Zaretskii Subject: Re: bug#43631: 28.0.50; CC Mode multiline strings grinds performance to a halt In-Reply-To: <837dsgqzr1.fsf@gnu.org> 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> Date: Sun, 27 Sep 2020 13:34:32 +0200 Message-ID: <87pn67312v.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.10 X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 43631 Cc: 43631@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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. Just wanted to let you know. Theo From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 28 15:33:35 2020 Received: (at 43631) by debbugs.gnu.org; 28 Sep 2020 19:33:35 +0000 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 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 Received: (qmail 74652 invoked by uid 3782); 28 Sep 2020 19:33:25 -0000 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 Received: (qmail 28168 invoked by uid 1000); 28 Sep 2020 19:33:25 -0000 Date: Mon, 28 Sep 2020 19:33:25 +0000 To: Theodor Thornhill Subject: Re: bug#43631: 28.0.50; CC Mode multiline strings grinds performance to a halt 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 Content-Disposition: inline In-Reply-To: <87pn67312v.fsf@thornhill.no> X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 43631 Cc: 43631@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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). From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 28 15:42:14 2020 Received: (at 43631) by debbugs.gnu.org; 28 Sep 2020 19:42:14 +0000 Received: from localhost ([127.0.0.1]:54054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMz2L-0002Zo-VL for submit@debbugs.gnu.org; Mon, 28 Sep 2020 15:42:14 -0400 Received: from out0.migadu.com ([94.23.1.103]:42424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kMz2J-0002Zf-9R for 43631@debbugs.gnu.org; Mon, 28 Sep 2020 15:42:12 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1601322129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=O+9BfP63ZghOm1+xkUUEpgtCtEeoRSuQk4ZnNxAnelI=; b=eE1Wq1e1omsj+/bYL6jgnNHqEGNZ7r5RBcBSUbgn54R8msjU5Nh+TShvANYJyH5UpmfTJv Q1ROZ0E33/sBmfdlcPga9riZ6cuQPnIVeid1r5+nD+TFAcLCpOfP7XDJPpgwyHXWSvoBjR w18foHjoZyGChxnKbP84573cv4bmonl6sfyHdbVsj9yaYavFUdv36RwQsC4ZG/ELRxRBVP vZvYgW64E8tG6ZaBuSkkuWmjWG8I1tFIuphFmz5akyJTzzOSoaULPojGV6tkiiSgt7N6be UZEGeqcTa/XTJ5R2jeJ7uZffqWcmOYSf00fsVdNpJGC2coLuq9kINwBAG4efYQ== From: Theodor Thornhill To: Alan Mackenzie Subject: Re: bug#43631: 28.0.50; CC Mode multiline strings grinds performance to a halt In-Reply-To: <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> <20200928193325.GA7626@ACM> Date: Mon, 28 Sep 2020 21:41:12 +0200 Message-ID: <87k0wd4rl3.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.10 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 43631 Cc: 43631@debbugs.gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Alan Mackenzie writes: > Hello, Theo. > [...] >> 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. ;-) Yeah, I put it back in some time ago ;) > > 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. > Thats very interesting, and thanks! -- Theo From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 13 11:27:12 2023 Received: (at 43631-done) by debbugs.gnu.org; 13 Oct 2023 15:27:12 +0000 Received: from localhost ([127.0.0.1]:47108 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qrK4G-0006LL-Gw for submit@debbugs.gnu.org; Fri, 13 Oct 2023 11:27:12 -0400 Received: from mail.muc.de ([193.149.48.3]:56451) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qrK4B-0006Kj-WF for 43631-done@debbugs.gnu.org; Fri, 13 Oct 2023 11:27:11 -0400 Received: (qmail 92620 invoked by uid 3782); 13 Oct 2023 17:26:37 +0200 Received: from acm.muc.de (pd953a199.dip0.t-ipconnect.de [217.83.161.153]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 13 Oct 2023 17:26:37 +0200 Received: (qmail 16674 invoked by uid 1000); 13 Oct 2023 15:26:36 -0000 Date: Fri, 13 Oct 2023 15:26:36 +0000 To: 43631-done@debbugs.gnu.org Subject: Re: bug#43631: 28.0.50; CC Mode multiline strings grinds performance to a halt Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 43631-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Emacs. This bug was fixed with my commits between 2021-08-12 and 2021-08-14. Closing. -- Alan Mackenzie (Nuremberg, Germany). From unknown Wed Aug 20 03:37:44 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 11 Nov 2023 12:24:09 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator