From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Konstantin Kharlamov Newsgroups: gmane.emacs.bugs Subject: bug#32175: Terrible performance of c++-mode refontifying Date: Sun, 17 May 2020 12:56:27 +0300 Message-ID: <592cda77-e000-c082-b8c9-00c1534976c9@yandex.ru> References: <32585dd1-ecab-4745-06b0-7a117c57447c@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="28791"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 Cc: 32175@debbugs.gnu.org To: Stefan Kangas , Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun May 17 11:57:10 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 1jaG2g-0007O5-In for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 May 2020 11:57:10 +0200 Original-Received: from localhost ([::1]:39606 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jaG2f-00021b-4u for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 May 2020 05:57:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jaG2Y-00021R-Pa for bug-gnu-emacs@gnu.org; Sun, 17 May 2020 05:57:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58998) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jaG2Y-0001wG-GP for bug-gnu-emacs@gnu.org; Sun, 17 May 2020 05:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jaG2Y-0000C0-EU for bug-gnu-emacs@gnu.org; Sun, 17 May 2020 05:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Konstantin Kharlamov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 May 2020 09:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32175 X-GNU-PR-Package: emacs Original-Received: via spool by 32175-submit@debbugs.gnu.org id=B32175.1589709404716 (code B ref 32175); Sun, 17 May 2020 09:57:02 +0000 Original-Received: (at 32175) by debbugs.gnu.org; 17 May 2020 09:56:44 +0000 Original-Received: from localhost ([127.0.0.1]:42311 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaG2G-0000BU-9t for submit@debbugs.gnu.org; Sun, 17 May 2020 05:56:44 -0400 Original-Received: from forward105o.mail.yandex.net ([37.140.190.183]:54058) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jaG2D-0000BE-54 for 32175@debbugs.gnu.org; Sun, 17 May 2020 05:56:42 -0400 Original-Received: from forward103q.mail.yandex.net (forward103q.mail.yandex.net [IPv6:2a02:6b8:c0e:50:0:640:b21c:d009]) by forward105o.mail.yandex.net (Yandex) with ESMTP id 9557D420115E; Sun, 17 May 2020 12:56:33 +0300 (MSK) Original-Received: from mxback1q.mail.yandex.net (mxback1q.mail.yandex.net [IPv6:2a02:6b8:c0e:39:0:640:25b3:aea5]) by forward103q.mail.yandex.net (Yandex) with ESMTP id 90F9E61E0009; Sun, 17 May 2020 12:56:33 +0300 (MSK) Original-Received: from vla4-d1b041059520.qloud-c.yandex.net (vla4-d1b041059520.qloud-c.yandex.net [2a02:6b8:c17:914:0:640:d1b0:4105]) by mxback1q.mail.yandex.net (mxback/Yandex) with ESMTP id EUaxjPPrg3-uXBeRHXo; Sun, 17 May 2020 12:56:33 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1589709393; bh=b47Mp0UUqZeoSMxrX+GQoPbUvRcq87aeMIiAjgJQu+0=; h=In-Reply-To:From:To:Subject:Cc:Date:References:Message-ID; b=hpTqt15bI7Hp5ZgxP/0W6fqjnBe5jJejCUSE0sDB9S2LdxkbhDPKr7OrEpGoMRorT Rayt5eGlDvygvacYtbMwu4zQZnbj8EDSFikGcgmTlQMfG0ztVrCMlz0phCcJ/+DSK/ AWbtE/h9d/t67KlsUx1iomSZw8CTigvY4uvFURls= Authentication-Results: mxback1q.mail.yandex.net; dkim=pass header.i=@yandex.ru Original-Received: by vla4-d1b041059520.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 78GBER7lcB-uWWiaFu7; Sun, 17 May 2020 12:56:32 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) In-Reply-To: Content-Language: en-GB-large 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:180444 Archived-At: Thanks! I should note, I haven't seen this problem for a while. But I struggle to say if it's been fixed or is it because hw I work on got more powerful. On 5/17/20 6:49 AM, Stefan Kangas wrote: > Hi Alan, > > This bug was reported in July 2018 but got no followup. > > Perhaps you could take a look? > > Best regards, > Stefan Kangas > > Konstantin Kharlamov writes: > >> Sometimes for working with C++ code I start experiencing lags for typing >> the text, like, 1-second delay between pressing the key and the actual >> text appearing. This does not happen at the beginning of the work, but >> rather after Emacs have been running for a while. >> >> It seems to be a per-buffer issue. E.g. right now I >> have the problem in one c++mode buffer, but not in another. >> >> This problem have definitely existed for 2 years (maybe more). I >> didn't report it because I thought it's my computer slow. I attached >> profiling result at the end, and I remember that some years ago traces >> of low performance have also been leading to functions about >> refontifying. >> >> Emacs version: GNU Emacs 27.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version >> 3.22.30) of 2018-07-06 >> (It's 12 days old build from git, commit 3bbd4ffc68b) >> >> FWIW it's built with -flto -march=native options, i.e. I have as much >> optimization as possible. >> >> Profiling below is done by pressing key, then waiting for >> symbol to appear; and repeating this for ≈10 times. >> >> - redisplay_internal (C function) 6900 69% >> - jit-lock-function 6887 69% >> - jit-lock-fontify-now 6887 69% >> - jit-lock--run-functions 6873 69% >> - run-hook-wrapped 6873 69% >> - # 6873 69% >> - font-lock-fontify-region 6873 69% >> - c-font-lock-fontify-region 6866 69% >> - font-lock-default-fontify-region 6514 65% >> - font-lock-fontify-keywords-region 6447 65% >> - c-font-lock-declarations 5059 51% >> - c-find-decl-spots 5012 50% >> - c-bs-at-toplevel-p 2972 29% >> - c-brace-stack-at 2937 29% >> - c-update-brace-stack 2831 28% >> - c-syntactic-re-search-forward 1263 12% >> + c-beginning-of-macro 548 5% >> # 6 0% >> - c-forward-<>-arglist 1220 12% >> - c-forward-<>-arglist-recur 1041 10% >> + c-syntactic-re-search-forward 285 2% >> + c-forward-<>-arglist-recur 245 2% >> + c-backward-token-2 125 1% >> c-forward-sws 52 0% >> + c-backward-sws 12 0% >> c-beginning-of-current-token 48 0% >> match-string-no-properties 6 0% >> + # 1823 18% >> + c-beginning-of-macro 40 0% >> c-backward-sws 8 0% >> c-forward-sws 6 0% >> # 4 0% >> + c-backward-token-2 3 0% >> + c-font-lock-enclosing-decls 240 2% >> + # 203 2% >> + c-font-lock-<>-arglists 183 1% >> + c-font-lock-cut-off-declarators 176 1% >> + color-identifiers:colorize 140 1% >> + c-font-lock-raw-strings 45 0% >> + c-font-lock-invalid-single-quotes 37 0% >> + c-font-lock-enum-tail 34 0% >> # 31 0% >> # 29 0% >> + c-font-lock-complex-decl-prepare 25 0% >> # 24 0% >> # 22 0% >> + c-font-lock-c++-lambda-captures 18 0% >> # 9 0% >> # 3 0% >> eval 3 0% >> c-font-lock-enum-body 3 0% >> + font-lock-fontify-syntactically-region 40 0% >> + c-before-context-fl-expand-region 348 3% >> + eval 9 0% >> + mode-line-default-help-echo 4 0% >> - ... 1411 14% >> Automatic GC 1411 14% >> + command-execute 1252 12% >> + flycheck-handle-signal 301 3% >> + timer-event-handler 32 0% >> + evil-repeat-post-hook 5 0% >> global-highlight-symbol-mode-check-buffers 5 0% >> evil--jump-hook 1 0%