From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#58558: 29.0.50; re-search-forward is slow in some buffers Date: Wed, 12 Apr 2023 10:06:03 -0400 Message-ID: References: <877d10r21x.fsf@localhost> <87tu1zd2c6.fsf@localhost> <83h6xzphxm.fsf@gnu.org> <87wn6vbfaa.fsf@localhost> <838rjbpecw.fsf@gnu.org> <87fsdjwb4e.fsf@localhost> <874jtyuqax.fsf@localhost> <83zgbqm8q6.fsf@gnu.org> <87sfhit8ug.fsf@localhost> <83tu1ym6jo.fsf@gnu.org> <87h6xyt77x.fsf@localhost> <87h6ttkz6n.fsf@localhost> <838rf5qkpt.fsf@gnu.org> <87lej0zv92.fsf@localhost> <83ttxol6f5.fsf@gnu.org> <87h6tolybs.fsf@localhost> <87zg7e8xnt.fsf@localhost> <83ttxmab7x.fsf@gnu.org> <87sfd5b4oy.fsf@localhost> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29703"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 58558@debbugs.gnu.org, larsi@gnus.org, Ihor Radchenko , Eli Zaretskii To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 12 16:07:21 2023 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 1pmb84-0007UP-Uh for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 12 Apr 2023 16:07:21 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmb7o-00065N-TU; Wed, 12 Apr 2023 10:07:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pmb7m-00064F-P6 for bug-gnu-emacs@gnu.org; Wed, 12 Apr 2023 10:07:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pmb7m-0003G6-Ge for bug-gnu-emacs@gnu.org; Wed, 12 Apr 2023 10:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pmb7l-0002Dp-OS for bug-gnu-emacs@gnu.org; Wed, 12 Apr 2023 10:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 12 Apr 2023 14:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58558 X-GNU-PR-Package: emacs Original-Received: via spool by 58558-submit@debbugs.gnu.org id=B58558.16813083758475 (code B ref 58558); Wed, 12 Apr 2023 14:07:01 +0000 Original-Received: (at 58558) by debbugs.gnu.org; 12 Apr 2023 14:06:15 +0000 Original-Received: from localhost ([127.0.0.1]:40534 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmb71-0002Cd-Ad for submit@debbugs.gnu.org; Wed, 12 Apr 2023 10:06:15 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:57150) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmb6y-0002CO-2v for 58558@debbugs.gnu.org; Wed, 12 Apr 2023 10:06:14 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 71C0310011B; Wed, 12 Apr 2023 10:06:06 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 6739A1000E7; Wed, 12 Apr 2023 10:06:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1681308364; bh=8/D09NeGD/Q8U9anXDbzeJDRxxYMY6r9oI0d9ZBPR+k=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=lYen3mCvv7yVa1QbYadHgro8l3MagXhk4J3X7NaM/k+oQGj6j63nyuZiYpBQOYZBI uSyZok5GGMB1bVyNVWFkKn91JVSmg/lyWu25GcJYHGrpz0BXpmcgsY58U2qBi3rfvL cC4h1nJ4dn4RP9M9BlpjmlMjFgmHZiywUa3sVX2OpVZehmBEi1S6KuhhPPviWJ0OMr nHeFH9Puzzs831xzhlP6BVCynuLJtHfV7/TbkCWLvCYgIk/01cBgN5Ef1OlrtyC9gM Si+FQz8cJ71VTbimLwD4YRaVX8HSu6NwwPzhbFVHvyPNz6B3fOo0cRZ2kOdl0ah5OT zHA8if4aAFvSg== Original-Received: from pastel (unknown [45.72.217.176]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id E5A471202F2; Wed, 12 Apr 2023 10:06:03 -0400 (EDT) In-Reply-To: <87sfd5b4oy.fsf@localhost> (Ihor Radchenko's message of "Wed, 12 Apr 2023 13:39:09 +0000") 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:259745 Archived-At: > 1. emacs -Q > 2. M-: (require 'cc-langs) > 3. C-x b asd > 4. M-: parse-sexp-lookup-properties => t > > On Emacs 28, (4) yields nil. I suspect that the patch below might fix the immediate problem. Of course, setting `parse-sexp-lookup-properties` should not have such a major performance impact, so maybe we should keep digging into the problem. Stefan diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index aa6f33e9cab..92ab0c02de1 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el @@ -2153,20 +2153,13 @@ c-emacs-features ;; Record whether the `category' text property works. (if c-use-category (setq list (cons 'category-properties list))) - (let ((buf (generate-new-buffer " test")) - parse-sexp-lookup-properties - parse-sexp-ignore-comments - lookup-syntax-properties) ; XEmacs - (with-current-buffer buf + (with-current-buffer (generate-new-buffer " test") + ;; Do the let-binding in the right buffer, in case they're buffer-local. + (let ((parse-sexp-lookup-properties t) + (parse-sexp-ignore-comments t) + (lookup-syntax-properties t)) ; XEmacs (set-syntax-table (make-syntax-table)) - ;; For some reason we have to set some of these after the - ;; buffer has been made current. (Specifically, - ;; `parse-sexp-ignore-comments' in Emacs 21.) - (setq parse-sexp-lookup-properties t - parse-sexp-ignore-comments t - lookup-syntax-properties t) - ;; Find out if the `syntax-table' text property works. (modify-syntax-entry ?< ".") (modify-syntax-entry ?> ".") @@ -2231,8 +2224,8 @@ c-emacs-features (if (bobp) (setq list (cons 'col-0-paren list))))) - (set-buffer-modified-p nil)) - (kill-buffer buf)) + (set-buffer-modified-p nil) + (kill-buffer (current-buffer)))) ;; Check how many elements `parse-partial-sexp' returns. (let ((ppss-size (or (c-safe (length