From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#25706: 26.0.50; Slow C file fontification Date: Mon, 30 Nov 2020 17:53:04 +0100 Message-ID: References: <55C404DC-1C29-449F-9A49-B20EDFFCFCEA@acm.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39423"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Lars Ingebrigtsen , 25706@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 30 17:55:20 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 1kjmSN-000A70-3j for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 Nov 2020 17:55:19 +0100 Original-Received: from localhost ([::1]:45264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kjmSM-00013c-13 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 Nov 2020 11:55:18 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kjmR8-0007DO-E2 for bug-gnu-emacs@gnu.org; Mon, 30 Nov 2020 11:54:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44936) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kjmR8-0004wt-4H; Mon, 30 Nov 2020 11:54:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kjmR8-0000XR-2l; Mon, 30 Nov 2020 11:54:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Mon, 30 Nov 2020 16:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25706 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 25706-submit@debbugs.gnu.org id=B25706.16067551911994 (code B ref 25706); Mon, 30 Nov 2020 16:54:02 +0000 Original-Received: (at 25706) by debbugs.gnu.org; 30 Nov 2020 16:53:11 +0000 Original-Received: from localhost ([127.0.0.1]:56482 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kjmQJ-0000W5-6V for submit@debbugs.gnu.org; Mon, 30 Nov 2020 11:53:11 -0500 Original-Received: from mail70c50.megamailservers.eu ([91.136.10.80]:60622) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kjmQH-0000Vt-B1 for 25706@debbugs.gnu.org; Mon, 30 Nov 2020 11:53:10 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1606755187; bh=n4OgW7s0DmR8lO0DEcfz3aBqZxVFzwoBNZMOC8Ky8TQ=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=LWnxAG8uK3mYE0c6QVMFZ3NfYGYDy/Et1vBshQyoWHYYXth0uLRqU1AeHIiHHXyTh TXZlo/wtYSPv1YPKYXl7pKhNi/f0Xro+9ppgM2PjxaxpXIQFvPRo/3fNRlvkxQXb3u PfyNeEg0TD/a1ycvCON1fuCIZpN8pkXU15Ljw4Ig= Feedback-ID: mattiase@acm.or Original-Received: from stanniol.lan (c-064ae655.032-75-73746f71.bbcust.telenor.se [85.230.74.6]) (authenticated bits=0) by mail70c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0AUGr4UE019897; Mon, 30 Nov 2020 16:53:06 +0000 In-Reply-To: X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A782F25.5FC52373.0074, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=H6ulPNQi c=1 sm=1 tr=0 a=Ni+dBsiEfW2GqKMPYZim9A==:117 a=Ni+dBsiEfW2GqKMPYZim9A==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=mlS12_3StJfIhYOSgfwA:9 a=CjuIK1q_8ugA:10 a=pHzHmUro8NiASowvMSCR:22 a=Ew2E2A-JSTLzCXPT_086:22 X-Origin-Country: SE 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:194658 Archived-At: 30 nov. 2020 kl. 17.38 skrev Alan Mackenzie : > Yes. I've had a look at the file, and it's large and lacking in = braces. > There are functions in CC Mode which search backwards for opening = braces > to establish context. When there are none, the search goes back to = BOB. > Lots of these searches, not efficiently cached, take a long time. >=20 > It's a problem with CC Mode, not with the source file. It's a known > problem, and not easy to fix. Actually, it's the underscores! Demo: fill a file with the line pairs #define abc_defg_hij_klm__nop_qrst_uvw_xyz_w__ooa_cin_e__aoi__uynv(s) \ 0 repeated 1000 times, thus making it 2000 lines. Save as something.h. = Slow! Now replace each underscore with a letter. Save. Fast! Fontifying the 2000 line file (with underscores) takes longer than the = original 80000 line file. I started going through c-find-decl-spots and c-find-decl-prefix-search = (together there are while statements nested 4 deep) but am not sure = exactly where the trouble is. A regexp? Something syntax-char related = (since '_' has symbol syntax, not word)? CC-mode in general thrashes the regexp cache; the miss rate is at 27 % = for the original file, which is way too high. Enlarging the cache enough = to eliminate misses helps, but not nearly enough.