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 18:04:56 +0100 Message-ID: <86EC566E-0CE6-4D98-9025-0C0551CE1546@acm.org> References: <55C404DC-1C29-449F-9A49-B20EDFFCFCEA@acm.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_A07B4DFF-DC39-45F2-B823-E01E1FFDAB83" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35300"; 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 18:12:01 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 1kjmiX-00095a-1h for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 Nov 2020 18:12:01 +0100 Original-Received: from localhost ([::1]:54614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kjmiW-0001Vv-4V for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 Nov 2020 12:12:00 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40772) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kjmck-0003Fc-Ht for bug-gnu-emacs@gnu.org; Mon, 30 Nov 2020 12:06:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44958) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kjmck-0007JM-82; Mon, 30 Nov 2020 12:06:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kjmck-0002zz-2N; Mon, 30 Nov 2020 12:06: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 17:06: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.160675590811447 (code B ref 25706); Mon, 30 Nov 2020 17:06:02 +0000 Original-Received: (at 25706) by debbugs.gnu.org; 30 Nov 2020 17:05:08 +0000 Original-Received: from localhost ([127.0.0.1]:56504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kjmbs-0002yY-B5 for submit@debbugs.gnu.org; Mon, 30 Nov 2020 12:05:08 -0500 Original-Received: from mail1435c50.megamailservers.eu ([91.136.14.35]:33108 helo=mail263c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kjmbq-0002xo-12 for 25706@debbugs.gnu.org; Mon, 30 Nov 2020 12:05:07 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1606755899; bh=YGTaCI/u7Qg6hMepbWxkOzbhWtdmj52hcfuwTM7gfOc=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=imXT5aIO6LKC0zg9tS78HFpcDyWy7gG37SzugU3hKdkBwnwK6NsrZS2/zrV9aeEY5 hQ7hToMv8skk+bsZ8c3SZ6w6KRdkhcEUTser43l0vctebagbAtgFmtobLVnT1QfZ0x eOTyO+XGp/mNZpi/7YuFl0qznhTXAP24eOzli3n8= 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 mail263c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 0AUH4vt1032251; Mon, 30 Nov 2020 17:04:58 +0000 In-Reply-To: X-Mailer: Apple Mail (2.3445.104.17) X-CTCH-RefID: str=0001.0A782F25.5FC5263B.0035, 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=WbZylHpX c=1 sm=1 tr=0 a=Ni+dBsiEfW2GqKMPYZim9A==:117 a=Ni+dBsiEfW2GqKMPYZim9A==:17 a=M51BFTxLslgA:10 a=d-cXN2YMp8VolveLtjYA:9 a=CjuIK1q_8ugA:10 a=bfxJNhZvTkrBI0OQqeIA:9 a=De_Ol2h6w80A:10 a=pHzHmUro8NiASowvMSCR:22 a=6VlIyEUom7LUIeUMNQJH: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:194660 Archived-At: --Apple-Mail=_A07B4DFF-DC39-45F2-B823-E01E1FFDAB83 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > Actually, it's the underscores! Found it. Suggested fix attached. It can be improved: at least one pair of regexp group brackets can be = removed, but I didn't dare doing so because I wasn't sure if it would = throw some group numbers off by one. Alan, please, let's work together and remove unnecessary capture groups = from the regexps! Even XEmacs regexps support non-capturing brackets, = \(?:...\), and they save time, regexp stack space, and reduce the hassle = of computing the 'regexp depth' everywhere. --Apple-Mail=_A07B4DFF-DC39-45F2-B823-E01E1FFDAB83 Content-Disposition: attachment; filename=cc-underscores.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="cc-underscores.diff" Content-Transfer-Encoding: 7bit diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index d6089ea295..d1f795053c 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -967,7 +967,7 @@ c-opt-cpp-macro-define-start t (if (c-lang-const c-opt-cpp-macro-define) (concat (c-lang-const c-opt-cpp-prefix) (c-lang-const c-opt-cpp-macro-define) - "[ \t]+\\(\\(\\sw\\|_\\)+\\)\\(([^)]*)\\)?" + "[ \t]+\\(\\([[:word:]_]\\)+\\)\\(([^)]*)\\)?" ;; ^ ^ #defined name "\\([ \t]\\|\\\\\n\\)*"))) (c-lang-defvar c-opt-cpp-macro-define-start @@ -979,7 +979,7 @@ c-opt-cpp-macro-define-id t (if (c-lang-const c-opt-cpp-macro-define) (concat (c-lang-const c-opt-cpp-prefix) ; # (c-lang-const c-opt-cpp-macro-define) ; define - "[ \t]+\\(\\sw\\|_\\)+"))) + "[ \t]+\\([[:word:]_]\\)+"))) (c-lang-defvar c-opt-cpp-macro-define-id (c-lang-const c-opt-cpp-macro-define-id)) @@ -989,7 +989,7 @@ c-anchored-hash-define-no-parens t (if (c-lang-const c-opt-cpp-macro-define) (concat (c-lang-const c-anchored-cpp-prefix) (c-lang-const c-opt-cpp-macro-define) - "[ \t]+\\(\\sw\\|_\\)+\\([^(a-zA-Z0-9_]\\|$\\)"))) + "[ \t]+\\([[:word:]_]\\)+\\([^(a-zA-Z0-9_]\\|$\\)"))) (c-lang-defconst c-cpp-expr-directives "List of cpp directives (without the prefix) that are followed by an --Apple-Mail=_A07B4DFF-DC39-45F2-B823-E01E1FFDAB83--