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 11:20:17 -0400 Message-ID: References: <877d10r21x.fsf@localhost> <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> <8735559ncj.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="16903"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 58558@debbugs.gnu.org, Alan Mackenzie , Eli Zaretskii , larsi@gnus.org To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 12 17:21:16 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 1pmcHb-00048H-Qe for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 12 Apr 2023 17:21:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pmcHR-0002a5-LO; Wed, 12 Apr 2023 11:21:05 -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 1pmcHQ-0002Qc-3n for bug-gnu-emacs@gnu.org; Wed, 12 Apr 2023 11:21:04 -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 1pmcHP-0002nT-9N for bug-gnu-emacs@gnu.org; Wed, 12 Apr 2023 11:21:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pmcHO-0004Wb-Ig for bug-gnu-emacs@gnu.org; Wed, 12 Apr 2023 11:21:02 -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 15:21:02 +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.168131282817317 (code B ref 58558); Wed, 12 Apr 2023 15:21:02 +0000 Original-Received: (at 58558) by debbugs.gnu.org; 12 Apr 2023 15:20:28 +0000 Original-Received: from localhost ([127.0.0.1]:40644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmcGp-0004VF-PE for submit@debbugs.gnu.org; Wed, 12 Apr 2023 11:20:28 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:17595) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pmcGn-0004Ut-OA for 58558@debbugs.gnu.org; Wed, 12 Apr 2023 11:20:26 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 317568091E; Wed, 12 Apr 2023 11:20:20 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C2AB680630; Wed, 12 Apr 2023 11:20:18 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1681312818; bh=/SrlOmYzeD0e9S2osz9p9afnXxyCztoka2cgXsEhzdg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=airXF2gD0MTTH0Wk/yF1DLZ4y461UMbJC6hUehDvx1ZRot/IOWvse8nHlTpS79y1l FhiZEAlLCp2UseV3ZTQuRRhOt8LjbKNKqumyb7T4Kf661pPuPU6CJBJglW6IBnguUL JqbhWzo7B+o7IhUh4bR15qv5WzWQbAFwytv4au3x3Q3n/j6QKYO/F4fwoMxwoFUHDZ aETC1IFdI3g1iQabbWVm37n/TeGS6E2zWC0SXY2hUGZjwGyxdAglCObT3SwmD83iIw 0H6bgJ/9Iqm9damuwRC/0x1v8p8xXggCme1svAqEnbb7x4TZ4loPgkyKVqToqkLxEF X6EJ7lKn4Bgyw== Original-Received: from pastel (unknown [45.72.217.176]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 565921202FB; Wed, 12 Apr 2023 11:20:18 -0400 (EDT) In-Reply-To: <8735559ncj.fsf@localhost> (Ihor Radchenko's message of "Wed, 12 Apr 2023 14:39:08 +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:259758 Archived-At: > I confirm that it does fix the problem. But why not `with-temp-buffer'? I think it's for compatibility with TECO Emacs or something like that :-) > Also, how come `setq' changes the global variable value despite it is > let-bound? Because the `let` and the `setq` were not performed in the same buffer, so if the var is buffer-local ... > To improve the performance, the two obvious ways are reducing the number > of SYNTAX_TABLE_BYTE_TO_CHAR calls in re_match_2_internal and speeding > up buf_bytepos_to_charpos. I think the behavior you experience doesn't require "speeding up" but it requires "fixing a performance bug". Technically it's the same, but still.. > I'd prefer the latter as it is used ubiquitously across Emacs and > making point lookup faster will thus benefit other places as well. Why choose? For the former, we could probably extend the `b_property` and `e_property` fields of `gl_state` (which hold charpos) to also store their bytepos equivalent, which should significantly reduce the number of conversions between bytepos and charpos. Stefan